Results 1 to 7 of 7

Thread: [Resolved]XHTML 1.1, javaScript, and roll over buttons

Threaded View

  1. #1

    Thread Starter
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Resolved [Resolved]XHTML 1.1, javaScript, and roll over buttons

    The following code is typically used when someone wants to add rollover buttons on their website (or, atleast what I used to use)
    Code:
    <script type="text/javascript">
    	 if (document.images)
       	{
    	   	  <!-- Home -->
       		  homeon= new Image(139,46);
       		  homeon.src="img/top_nav_home.png";  
         		  homeoff= new Image(139,46);
        		  homeoff.src="img/top_nav_home_over.png";
      	 }
    
    	function un_hover(imgName)
     	{
     		  if (document.images)
        		{
        			  imgOn=eval(imgName + "on.src");
         			 document[imgName].src= imgOn;
       		 }
    	 }
    
    	function hover(imgName)
     	{
       		if (document.images)
       		 {
         			 imgOff=eval(imgName + "off.src");
          			document[imgName].src= imgOff;
        		}
    	 }
    	 </script>
    	<!--Java Script End-->
    And this where the rollover should go:

    Code:
    <a href="index.php" onmouseover="hover('home')" onmouseout="un_hover('home')" >
    <img src="img/top_nav_home.png" class="alpha" name="home" width="139px" height="46px" alt="Home" /></a>
    Now I want to be XHTML 1.1 compliant and I want my code to validate. How do you do rollover buttons without the name attribute since that doesn't exist in XHTML 1.1?
    Last edited by Kasracer; Jun 5th, 2005 at 12:06 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width