|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello All,
I am having some difficulty in replacing simple buttons with graphics. Whenever I do this, it disables the java function altogether. The code looks right, but I dont know... Here is where the problem is. The input needs to be changed to "image", right?? Maybe somebody can whip up a sample of what the code should look like if it were to point to an image src for the buttons. I have totally screwed it up... Thanks, Brian Code:
var current = 0;
function initArray() {
this.length = initArray.arguments.length;
for (var i = 0; i < this.length; i++) {
this[i] = initArray.arguments[i];
}
}
var picz = new initArray(
"images/1.jpg",
"images/2.jpg",
"images/3.jpg",
"images/4.jpg",
"images/5.jpg",
"images/6.jpg",
"images/7.jpg",
"images/8.jpg",
"images/9.jpg",
"images/10.jpg"
);
document.write('<img name="jscriptimg" src="'+picz[0]+'">');
function checkIt(val) {
var goodnum = current+val;
if (goodnum < 0) ("You can't go any further back!");
else if (goodnum > picz.length-1) ("You can't go any further forward!");
else document.jscriptimg.src = picz[goodnum];
current = goodnum;
}
//-->
</script>
<br><input type="button" value="Back" onclick="checkIt(-1)"> <input type="button" value="Forward" onclick="checkIt(1)">
</center>
</form>
<body>
</body>
</html>
|
|
#2
|
|||
|
|||
|
You don't need that javascript, simply do like this:
<input alt="Back" type="image" src="/images/10.jpg" name="BackButton" /> But what are the purpose of the script you have? To move forward with javascript: <a href="javascript:history.go(+1);"><img src="/images/forward_icon.gif" alt="Forward"></a> To move back: <a href="javascript:history.go(-1);"><img src="/images/back_icon.gif" alt="Back"></a> |
|
#3
|
|||
|
|||
|
Yes, you are correct. The other part of the script in question is to nav back. The full function is backwards and forwards.
I will see if this fixes the problem that I have been encountering. From the look of it, your script is a simplified version of what I had. I will put it to work for me. Thanks, Brian |
|
#4
|
|||
|
|||
|
Its still not fixed (link)
That script was for the backward and forward function for a browser. What I need is to replace those forward and backward buttons with graphics. Here is a simple example (link). You will understand once you see what I am talking about...
For some reason, when I try to do the graphical replacement, the javascript becomes disabled. Not sure why... http://www.brianzero.com/test.htm Brian |
|
#5
|
|||
|
|||
|
Well, this should work:
<a href="javascript:checkIt(-1);"><img src="backwards_icon.gif" alt="Backward"></a> <a href="javascript:checkIt(1);"><img src="forward_icon.gif" alt="Forward"></a> or this: <img src="backwards_icon.gif" alt="Backward" onclick="checkIt(-1)"> <img src="forward_icon.gif" alt="Forward" onclick="checkIt(1)"> |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > I need to replace those ugly buttons with graphics |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|