Javascript problem
-
I'm making a simple html page with an external .js file that will write the navigation to a page. My problem is that for some reason the page will not call the function in the external file from the page. Here is my .js file: function WriteMenu(selectedNav) { document.writeln('<table id="NavigationTable">'); document.writeln('<tr>'); document.writeln(GetNavItem('Home', 'index.html', selectedNav == 'home')); document.writeln(GetNavItem('History', 'history.html', selectedNav == 'history')); document.writeln(GetNavItem('Castes', 'castes.html', selectedNav == 'castes')); document.writeln(GetNavItem('Map', 'Library/Images/map.gif', selectedNav == 'map')); document.writeln(GetNavItem('Rules', 'rules.html', selectedNav == 'rules')); document.writeln(GetNavItem('Resources', 'resources.html', selectedNav == 'resources')); document.writeln('<tr>'); document.writeln('</table>'); } function GetNavItem(text, url, isSelected) { var navItem; if (isSelected) { navItem = '<td class="selected"><a href="' + url + '">' + url + '<a></td>'; } else { navItem = '<td><a href="' + url + '">' + url + '<a></td>'; } return navItem; } Here are the answers to obvious questions. Here is my header: <script language="Javascript" type="text/javascript" src="Library/JS/Menu.js" /> Here is where I am trying to call the function. This is inside the body tags for the page. <script type="text/javascript"> WriteMenu('home'); </script> I even tried adding an alert to the function and I get nothing. Why won't it call the functions?
Broken Bokken You can't carry out a ninja-style assasination dressed as an astronaut. It's the luminous fabric; too visible. - Tripod The story of your fighting is a poem of two words: YOU SUCK.
-
I'm making a simple html page with an external .js file that will write the navigation to a page. My problem is that for some reason the page will not call the function in the external file from the page. Here is my .js file: function WriteMenu(selectedNav) { document.writeln('<table id="NavigationTable">'); document.writeln('<tr>'); document.writeln(GetNavItem('Home', 'index.html', selectedNav == 'home')); document.writeln(GetNavItem('History', 'history.html', selectedNav == 'history')); document.writeln(GetNavItem('Castes', 'castes.html', selectedNav == 'castes')); document.writeln(GetNavItem('Map', 'Library/Images/map.gif', selectedNav == 'map')); document.writeln(GetNavItem('Rules', 'rules.html', selectedNav == 'rules')); document.writeln(GetNavItem('Resources', 'resources.html', selectedNav == 'resources')); document.writeln('<tr>'); document.writeln('</table>'); } function GetNavItem(text, url, isSelected) { var navItem; if (isSelected) { navItem = '<td class="selected"><a href="' + url + '">' + url + '<a></td>'; } else { navItem = '<td><a href="' + url + '">' + url + '<a></td>'; } return navItem; } Here are the answers to obvious questions. Here is my header: <script language="Javascript" type="text/javascript" src="Library/JS/Menu.js" /> Here is where I am trying to call the function. This is inside the body tags for the page. <script type="text/javascript"> WriteMenu('home'); </script> I even tried adding an alert to the function and I get nothing. Why won't it call the functions?
Broken Bokken You can't carry out a ninja-style assasination dressed as an astronaut. It's the luminous fabric; too visible. - Tripod The story of your fighting is a poem of two words: YOU SUCK.
Don't ask me why, but try replacing
with