NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Feb 20, 2012 20:30:52 GMT -8
<script type="text/javascript"> //<!-- var menutds = document.getElementByTagName('td'); for(i=0;i<menutds.length;i++){ if(menutds.id=='menuitem'){ var menulink = menutds.document.getElementsByTagName('a'); //for(j=0;j<menulink.length;j++){ if(menulink.item.href==location.href){ menutds.id='currentitem'; } } } //--> </script>
Do I need the second for loop? And in the statement menulink.item.href=='location.href'; Do I need to make the link the full href="http://ukskc.proboards.com/index.cgi?action=home" or will it catch href="/index.cgi?action=home"
|
|
|
Post by Wormopolis on Feb 20, 2012 20:33:25 GMT -8
you keep putting document. in there. look at what I put in previous post.
|
|
NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Feb 20, 2012 21:38:13 GMT -8
<script type="text/javascript"> //<!-- var menutds = document.getElementByTagName('td'); for(i=0;i<menutds.length;i++){ if(menutds.id=='menuitem'){ var menulink = menutds.getElementsByTagName('a'); for(j=0;j<menulink.length;j++){ if(menulink[j].href=='location.href'){ menutds.id='currentitem'; } } } } //--> </script>
|
|
|
Post by Wormopolis on Feb 20, 2012 23:12:15 GMT -8
thats better, but look at
if(menulink[j].href=='location.href'){
you are checking to see if the href is LITERALLY "location.href"
|
|
NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Feb 21, 2012 6:22:25 GMT -8
<script type="text/javascript"> //<!-- var menutds = document.getElementByTagName('td'); for(i=0;i<menutds.length;i++){ if(menutds.id=='menuitem'){ var menulink = menutds.getElementsByTagName('a'); for(j=0;j<menulink.length;j++){ if(menulink[j].href == location.href){ menutds.id='currentitem'; menulink[j].id='currentlink'; } } } } //--> </script>
|
|
|
Post by Wormopolis on Feb 21, 2012 17:57:41 GMT -8
result?
|
|
NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Feb 21, 2012 19:01:02 GMT -8
Nothing.
|
|
|
Post by Wormopolis on Feb 21, 2012 19:22:37 GMT -8
these links... are they standard or were they typed out? could it be a case-sensitive issue?
|
|
NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Feb 21, 2012 19:51:35 GMT -8
I had to type them out.
Edit: I see it now..font tag is in the way. Edit: Okay thought font tag was in the way but moving it didn't make the code work. Edit: Just realized I wasn't using the match method anyways so the location of the font tags is moot.
<table border="0" class="menutab"> <tr> <td id="menuitem" style="border-left:0px solid #000000;"> <a href="/index.cgi" class="menul"> <font id="menufont">Home</font></a> <br/>Homepage</td>
<td id="menuitem"> <a href="/index.cgi?action=newestthreads" class="menul"> <font id="menufont">New Topics</font></a> <br/>Todays Posts</td>
<td id="menuitem"> <a href="http://help.proboards.com/" class="menul"> <font id="menufont">Help</font></a> <br/>Getting Started</td>
<td id="menuitem"> <a href="/index.cgi?action=search" class="menul"> <font id="menufont">Search</font></a> <br/>Site Search</td>
<td id="menuitem" class="member" style="display:none;"> <a href="/index.cgi?action=members" class="menul"> <font id="menufont">Members</font></a> <br/>Member List</td>
<td id="menuitem" class="member" style="display:none;"> <a href="/index.cgi?action=calendar" class="menul"> <font id="menufont">Calendar</font></a> <br/>Calendar of Events</td>
<td id="menuitem" class="admin" style="display:none;"> <a href="http://ukskc.proboards.com/index.cgi?action=admin" class="menul"> <font id="menufont">Admin</font></a> <br/>Admin Controls</td>
<td id="menuitem" class="member" style="display:none;"> <a href="http://index.cgi?action=viewprofile" class="menul"> <font id="menufont">Profile</font></a> <br/>Your Profile</td> <td id="menuitem" class="member" style="display:none;border-right:0px solid #000000;"> <a href="/index.cgi?action=logout"> <font id="menufont">Logout</font></a> <br/>Member Logout</td>
<td id="menuitem" class="guest"> <a href="/index.cgi?action=login" class="menul"> <font id="menufont">Login</font></a> <br/>Member Login</td>
<td id="menuitem" class="guest" style="border-right:0px solid #000000;"> <a href="/index.cgi?action=register" class="menul"> <font id="menufont">Register</font></a> <br/>New Members</td>
</tr> </table>
|
|
|
Post by Wormopolis on Feb 23, 2012 0:45:30 GMT -8
ah. no your problem is the href for those menu items ISNT what the location URL is. compare the two and what is missing?
|
|
NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Feb 23, 2012 7:35:08 GMT -8
Changed the links to include the entire url but still not working.
|
|
|
Post by Wormopolis on Feb 23, 2012 21:24:36 GMT -8
var menutds = document.getElementsByTagName('td');
|
|
NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Feb 23, 2012 21:33:27 GMT -8
Yep that works now.
|
|
|
Post by Wormopolis on Feb 23, 2012 22:04:58 GMT -8
I miss that one myself a lot
|
|