Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with navigation

Status
Not open for further replies.
Sep 7, 2009
29
0
0
US
Hello added a navigation javascript to my page with an existing slideshow javascript. The slideshow javascript loads fine. The navigation javascript doesn't load. Can someone assist me. Here is my code snippet.

Code:
Html
[B]<script type="text/javascript">


function initAll() {
	var allLinks = document.getElementsByTagName("a");
	
	for (var i=0; i<allLinks.length; i++) {
		if (allLinks[i].className.indexOf("menuLink") > -1) {
			allLinks[i].onclick = retFalse;
			allLinks[i].onmouseover = toggleMenu;
		}
	}
}

function toggleMenu() {
	var startMenu = this.href.lastIndexOf("/")+1;
	var stopMenu = this.href.lastIndexOf(".");
	var thisMenuName = this.href.substring(startMenu,stopMenu);

	document.getElementById(thisMenuName).style.display = "block";

	this.parentNode.className = thisMenuName;
	this.parentNode.onmouseout = toggleDivOff;
	this.parentNode.onmouseover = toggleDivOn;	
}

function toggleDivOn() {
	document.getElementById(this.className).style.display = "block";
}

function toggleDivOff() {
	document.getElementById(this.className).style.display = "none";
}

function retFalse() {
	return false;
}
[/B]
</script>
<script>
		<!--
   function view_win(url)
   {
      aWindow=window.open(url,"change_window","scrollbars=2,resizable,width=600,height=500,left=150,top=50");
   }
   function PopUp() 
   {   remoteWin = window.open("movieplayer.htm", "popup", 'width=200,height=250,resizable=1,scrollbars=0,toolbar=0');
		remoteWin.focus();
   }
		// -->
</script>
<script language="JavaScript">

 
<!--
  var Text = "";
  var speed = 100;      
  var StartPos = 110;                       
  var TextLength = Text.length;  
  var Position = 1 - StartPos;          

function StatusLineText()            
{  Position++;
   var StatusText="";
   if (Position == TextLength)
      Position = 1 - StartPos;
   if (Position < 0)
   {  for (var i=1; i <= Math.abs(Position); i++)
         StatusText = StatusText + " ";
      StatusText = StatusText + Text.substring(0, StartPos - i + 1);
   } 
   else
      StatusText = StatusText + Text.substring(Position, StartPos + Position);

   window.status = StatusText; 
   setTimeout("StatusLineText()",speed); 
} //-->

</script>
<script type="text/javascript" src="slideshow.js">
	</script>

<link rel="stylesheet" type="text/css" href="index_files/main.css">
<link rel="stylesheet" type="text/css" href="style.css">



<body topmargin="5" leftmargin="0" marginheight="0" marginwidth="0"  onload="runSlideShow()">









<link rel="stylesheet" type="text/css" href="index_files/main.css">
<script language="javascript">
     turl = new String(document.location.href);
     if (turl.indexOf('/') == 7)
     {  turl = turl.replace("/");
        document.location.href = turl;
     }
   function popupmission(address)
   {  theURL = '/' + address;
      window.open(theURL,'title','toolbar=no,location=no,status=no,menubar=no,scrollbars=0,resizable=no,width=520,height=600');
   }
</script>
<table width="742" align="center" border="0" cellpadding="0" cellspacing="0">
  <tbody><tr> 
    <td><table width="742" border="0" cellpadding="0" cellspacing="0">
        <tbody><tr> 
          <td width="167">
           <img src=".gif" alt="" width="166" border="0" height="122"></td>
          <td width="84">
           <img src=".jpg" alt="" width="84" border="0" height="122"></td>
          <td width="98">
           <img src=".jpg" alt="" width="98" border="0" height="122"></td>
          <td width="213">
           <img src=".jpg" alt="" width="213" border="0" height="122"></td>
          <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tbody><tr> 
                <td rowspan="3" width="53%">
                 <img src=".jpg" alt="" width="95" border="0" height="79"></td>
                <td width="47%">
                 <img src=".jpg" alt="" width="86" border="0" height="53"></td>
              </tr>
              <tr> 
                <td><a href=".gov/">
                 <img src=".gif" alt="home" width="86" border="0" height="11"></a></td>
              </tr>
              <tr> 
                <td><a href=".asp">
                 <img src=".gif" alt="" width="86" border="0" height="15"></a></td>
              </tr>
              <tr> 
                <td colspan="2"><a href=".asp">
                 <img src="" alt="" width="181" border="0" height="14"></a></td>
              </tr>
              <tr> 
                <td colspan="2"><a href=".asp">
                 <img src="" alt="" width="181" border="0" height="15"></a></td>
              </tr>
              <tr> 
                <td colspan="2"><a href=".asp">
                <img src="index_files/.gif" alt="Search" width="181" border="0" height="14"></a></td>
              </tr>
            </tbody></table></td>
        </tr>
      </tbody></table></td>
  </tr>
  <tr> 
    <td valign="top"> 
      <table width="742" bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0">
        <tbody><tr> 
          <td valign="top" width="173" bgcolor="#edf0f5" height="100%">
<table width="178" bgcolor="#edf0f5" border="0" cellpadding="0" cellspacing="0" height="100%">
              <tbody><tr> 
                <td valign="top" width="1" background="">
                 <img src="" alt="left side line art" width="1" border="0" height="1"></td>
                <td valign="top" width="166"> 
                  <table width="166" bgcolor="#ced5e0" border="0" cellpadding="0" cellspacing="0">
                    <tbody><tr> 
                      <td width="165" bgcolor="#edf0f5"><div align="center"><br><a href=""><img src="" width="96" align="center" border="0" height="53"></a><br> </div></td>
                    </tr>
                    
                            <tbody><tr><td><a class="navTier1" href=".asp">
                            <img src="index_files/tier2Bullet.gif" alt="bullet" width="4" border="0" height="6"> </a></td>
                          </tr>
                        </tbody></table></td>
                    </tr>

                    <tr> 
                      <td background="index_files/spacer.gif" height="1">
                       <img src="index_files/spacer.gif" alt="spacer" width="1" border="0" height="1"></td>
                    </tr>
                    <tr> 
                      <td width="165">
<table width="97%" border="0" cellpadding="0" cellspacing="2">
                          <tbody><tr>
                            <td><a class="navTier1" href=".asp">
                             <img src="index_files/tier2Bullet.gif" alt="bullet" width="4" border="0" height="6"> </a></td>
                          </tr>
                        </tbody></table>
                    
                       [B] <div>
                        <a href="menu1.html" class="menuLink">Clinics</a>
		                 <ul class="menu" id="menu1">
			              <li><a href="pg1.html">Clinic1</a></li>
                          <li><a href="pg2.html">Clinic2</a></li>
                          </ul>
                       </div>[/B]
                        
                        
                        
                        
   <tr><td><br>
                      <p align="center"> 
                      </p></td></tr>

<tr> 
                      <td>
                     <br><p align="center"> </p></td>
                    </tr>
                  </tbody></table></td>
                <td valign="top" width="11" align="right" background="index_files/prMainNavRt.gif">
                 <img src="index_files/prMainNavRt.gif" alt="right side line art" width="11" height="1"></td>
              </tr>
            </tbody></table>
      </td>
          <td valign="top" width="550" bgcolor="#ffffff">

<table style="border-collapse: collapse;" width="99%" border="0" bordercolor="#111111" cellpadding="4" cellspacing="4">
    <tbody><tr>
    <td colspan="2" valign="top">

   
                  <script language="JavaScript">
<!--
function openNew ( url )
{
open ( url );
}

function OnChange ( obj )
{
if ((obj.options[obj.selectedIndex].Name) == "old")
{
	window.location=( obj.options[obj.selectedIndex].value );
}
else
{
openNew ( obj.options[obj.selectedIndex].value );
}

}//-->

</script>

<table style="border-collapse: collapse;" width="100%" border="0" bordercolor="#111111" cellpadding="4" cellspacing="4">
    <tbody><tr>
    <td valign="top">

   
                  <p class="titles">;</p></td>
    <td valign="top" width="171" bgcolor="#edf0f5">
<p align="center">
<select size="1" onchange="OnChange ( this )" class="content">        
			<option selected="selected"></option>
			<option name="old" value=""></option>
        <!--<option Name="old" value=""></option>-->
        <option name="new" value=""></option>
        <option name="old" value=""</option>
        <option name="old" value="">On-Line
        Forms</option>
          <option name="old" value=""></option>
        <option name="old" value=".asp">The
        Administrator</option>
        <option name="old" value="">Locations</option>
    <option name="new" value=" ">Privacy & Accessibility Policy</option>

            
</select></p></td>
    </tr></tbody></table></td>
    </tr>

    <tr>
    <td valign="top">

   
                  <center>
                  <p> 
                  </p>
                  <p>
                  




<div id="content"> <br>
  <img id="picture" name="SlideShow" src="one.gif" alt=""width="350" height="195" border="0" align="middle" /><h2><br><span id = "caption">Municipal Way</span>
  </h2>
  

  
              









    
       <p class="content" align="center"><a href="javascript:void(0);" onclick="javascript:window.open('press/view.asp?press_id=239')"></a>
    
       </p><p class="content" align="center"><a href="javascript:void(0);" onclick="javascript:window.open('press/view.asp?press_id=234')</a>
    
       </p><p class="content" align="center"><a href="javascript:void(0);" onclick="javascript:window.open('press/view.asp?press_id=235')"> </a>
    
       </p><p class="content" align="center"><a href="javascript:void(0);" onclick="javascript:window.open('press/view.asp?press_id=238')</a>
    

   
     </p></td>
    </tr>
   <tr>
    <td colspan="2" valign="top">

<p class="content" align="center"><br>
Copyright © 2009  All rights reserved.
</p></td>
  </tr>
</tbody></table>

  		  
            </td>
          <td valign="top" width="14" align="right" background="index_files/prBodyRt.gif"><img src="index_files/prBodyRt.gif" alt="body line art" width="14" height="5"></td>
        </tr>
		
      </tbody></table></td>
  </tr>
  <tr> 
    <td><table id="remove" width="742" background="index_files/footer.gif" border="0" cellpadding="0" cellspacing="0" height="44">
        <tbody><tr>
          <td width="100%" height="100%"><p><br>

                                  
                              

           <a href="[URL unfurl="true"]http://www.leoncountyfl.gov/privacy.asp"[/URL] class="notes">Privacy & Accessibility Policy</a>
                      
           <a href="#" onclick="javascript:view_win('[URL unfurl="true"]http://www.gov/common/comments.asp');"[/URL] class="notes">Send Comments</a>
                      
          </p></td>
        </tr>
      </tbody></table>

    </td>
  </tr>
</tbody></table>

<!--

                                  

                                  

                                  



-->
<script language="Javascript">   
   function view_win(url)
   {
      aWindow=window.open(url + '?PageLocation=/lchd/index.asp','comments','scrollbars=2,resizable,width=500,height=400,left=180,top=150');
   }
  function sb80()
{
   msg="Under Florida Law, email addresses are public record. "
   msg=msg +  " If you do not want your email address released to a public records request, "
   msg=msg + " do not send electronic mail to this entity. Instead, contact this office by phone or in writing. ";
   alert(msg);
}
            </script>
</body></html>
 
The navigation javascript doesn't load.

Well, presumably it DOES load, given it's in the same file as the rest of your code (I assume it's one big file you've pasted as you've not delineated it otherwise).

Perhaps, therefore, the problem is that you're never actually calling the initAll function from anywhere?

Why not try calling that, perhaps from after the runSlideShow call in the body's onload attribute?

On another note, you seem to be missing the most basic of things, such as opening <html> and <head> tags, and a closing </head> tag. Why not get your page to validate properly before trying to diagnose things like this?

Also consider using a CSS menu system like SuckerFish that doesn't require JS to use, and look at using a CSS-based layout for your page to avoid all those ugly tables.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top