SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Jan 2002
    Location
    london
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    dreamweaver mx rollover problem

    Having a problem with this program.

    Here is the js in the head:

    HTML Code:
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }
    
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    }
    
    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    }
    
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }
    //-->
    </script>
    usual stuff from dreamweaver mx. and here's my table with rollover images:

    HTML Code:
    <table cellspacing="0" cellpadding="0" border="0" width="150">
    				<tr>
    					<td><img src="images/nav_top.gif" alt="navigation_top" width="150" height="9" border="0" align="top" /></td>
    				</tr>
    				<tr>
    			<!--<td><a href="#" onmouseover="MM_swapImage('about','','images/nav_about_on.gif',1)" onmouseout="MM_swapImgRestore()"> 
                <img name="about" src="images/nav_about_off.gif" alt="nav_about" width="150" height="16" border="0" align="top" /></a></td>//-->	
              <td><img name="about" src="images/nav_about_on.gif" alt="nav_about" width="150" height="16" border="0" align="top" /></td>
    				</tr>
    				<tr>
    					
              <td> <a href="javascript:;" onmouseover="MM_swapImage('mission','','images/nav_mission_on.gif',1)" onmouseout="MM_swapImgRestore()">
              <img name="mission" src="images/nav_mission_off.gif" alt="nav_mission" width="150" height="28" border="0" align="top" /></a></td>
    				</tr>
    				<tr>
    					
              <td> <a href="javascript:;" onmouseover="MM_swapImage('acquisitions','','images/nav_acquisitions_on.gif',1)" onmouseout="MM_swapImgRestore()">
              <img name="acquisitions" src="images/nav_acquisitions_off.gif" alt="nav_acquisitions" width="150" height="18" border="0" align="top" /></a></td>
    				</tr>
    				<tr>
    					
              <td> <a href="javascript:;" onmouseover="MM_swapImage('people','','images/nav_people_on.gif',1)" onmouseout="MM_swapImgRestore()">
              <img name="people" src="images/nav_people_off.gif" alt="nav_people" width="150" height="18" border="0" align="top" /></a></td>
    				</tr>
    				<tr>
    					
              <td> <a href="javascript:;" onmouseover="MM_swapImage('news','','images/nav_news_on.gif',1)" onmouseout="MM_swapImgRestore()">
              <img name="news" src="images/nav_news_off.gif" alt="nav_news" width="150" height="18" border="0" align="top" /></a></td>
    				</tr>
    				<tr>
    					
              <td> <a href="javascript:;" onmouseover="MM_swapImage('contact','','images/nav_contact_on.gif',1)" onmouseout="MM_swapImgRestore()">
              <img name="contact" src="images/nav_contact_off.gif" alt="nav_contact" width="150" height="18" border="0" align="top" /></a></td>
    				</tr>
    				<tr>
    					
              <td> <a href="javascript:;" onmouseover="MM_swapImage('links','','images/nav_links_on.gif',1)" onmouseout="MM_swapImgRestore()"> 
                <img name="links" src="images/nav_links_off.gif" alt="nav_links" width="150" height="16" border="0" align="top" /></a></td>
    				</tr>
    				<tr>
    					
              <td><a href="javascript:;"><img src="images/nav_bottom.gif" alt="nav_bottom" name="Image1" border="0" align="top" id="Image1" /></a></td>
    				</tr>
    				<tr>
    					<td><img src="images/1x1.gif" alt="1x1" width="1" height="15" border="0" align="top" /></td>
    				</tr>
    			</table>
    My problem is this:

    you'll see the name attribute for the gif "nav_links_off" is set as "links" - originally this had name set as "ulinks", but I wanted to change it because I'm now building my menu dynamically with php, however, when I changed it to "links", the rollover no longer works -- eh??!?! - I can find no other reference to "ulinks" other than that in the call to MM_swapImage() (yes, I was changing that one too) so I don't see how this can be.

    If I change the name back to "ulinks" it works again.

    Any ideas???

    Thanks
    L
    give me all your lentils

  2. #2
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Look in the call to MM_preloadImages(). I think DW puts this in the opening BODY tag.

    Is the page online?

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2002
    Location
    london
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    MM_preloadImages(), as the name suggests, preloads the images - it has nothing to do with the way the images are identified with the 'name' attribute in the <img> tag.
    give me all your lentils


Bookmarks

Posting Permissions

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