Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jun 2007
    Posts
    21
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Cant get multiple instances of javascript enabled button to work

    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 = ""

    Code:
    <!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>

  • #2
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    I can't understand a word. JPEG button? What?

  • #3
    New Coder
    Join Date
    Jun 2007
    Posts
    21
    Thanks
    3
    Thanked 0 Times in 0 Posts
    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:
    Code:
    <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.
    Last edited by funkysig; 02-26-2008 at 06:45 PM.

  • #4
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    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.
    Code:
    <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>

  • Users who have thanked Apostropartheid for this post:

    funkysig (03-12-2008)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •