...

View Full Version : Cant get multiple instances of javascript enabled button to work



funkysig
02-26-2008, 06:59 PM
My problem is that I need to replace every instance of a .jpg button my new javascript enabled button. The button works great alone, but when I add another button I can't seem to get it to work. I know it has something to do with the name = ""


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" src="zMore Info-files/scr7faa.js"></script>
</head>

<body>
<a onMouseOver='xpe("r7faao");' onMouseOut='xpe("r7faan");' onMouseDown='xpe("r7faac");'><img id="xpi_r7faa" src="zMore Info-files/btr7faa_0.gif" name="vbr7faa" width="98" height="28" border="0" alt="More Info"/></a>
</p>
<p><a onMouseOver='xpe("r7faao");' onMouseOut='xpe("r7faan");' onMouseDown='xpe("r7faac");'><img id="xpi_r7faa1" src="zMore Info-files/btr7faa_0.gif" name="vbr7faa1" width="98" height="28" border="0" alt="More Info"/></a></p>
</body>
</html>

Apostropartheid
02-26-2008, 07:17 PM
I can't understand a word. JPEG button? What?

funkysig
02-26-2008, 07:35 PM
Sorry,
I cannot add more than one of my newly created javascript enabled button (onMouseOver, onMouseDown, an onMouseOut) to my HTML page. This new button is replacing my original JPEG button, this I guess is irrelevant. If you look at the code from above, I have two instances of that newly created javascript button. This is an unsuccessful code because the buttons do not perform the interactive functions of the onMouseOver, onMouseDown, etc... This becomes a successful code if I remove one of the instances of the javascript button.

This is one button:

<a onMouseOver='xpe("r7faao");' onMouseOut='xpe("r7faan");' onMouseDown='xpe("r7faac");'><img id="xpi_r7faa1" src="zMore Info-files/btr7faa_0.gif" name="vbr7faa1" width="98" height="28" border="0" alt="More Info"/></a>

If I delete this from the original HTML page (code from first post), I then have one button that works with all of its functions (onMouseOver, onMouseDown, etc...). I need to be able to have more than one of these buttons on my HTML page (like code from first post even though incorrect). The reason I stated that I am replacing the original JPEG button is because I have about 120 of these buttons to replace and I was hoping to use the Dreamweaver "find and replace" tool to replace all of these original buttons on site with the button that I have written in the code box.

Thanks for reading my clarification.
Once again sorry for sloppy writing.

Apostropartheid
02-26-2008, 09:36 PM
You're probably getting a scripting error because there can only be one instance of a name in HTML: it's unique. But you're going about it the wrong way entirely.

<style type="text/css">
a.moreInfo:link {
background: url(path_to_initial_image.png);
text-indent: -9999em;
height: /*image height*/;
width: /*image width*/;
display: block;
}
a.moreInfo:hover {
background: url(path_to_rollover_image.png);
}
</style>
<a href="/moreinfo.html" title="More info" class="moreInfo">More info</a>
<a href="/moreinfo.html" title="More info" class="moreInfo">More info</a>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum