Author |
Topic  |
|
Roland
Advanced Member
    
Netherlands
9335 Posts |
Posted - 02 November 2001 : 07:25:20
|
I have a part of my site where I place lyrics and just replaced all hard code for the sub-menu with an include for easier navigation and maintenance. However, when someone goes to a page with (for example) Aerosmith lyrics, the <td> with Aerosmith in it should change bgcolor. How can I implement this? The include file is in the folder http://www.frutzle.com/lyrics and all artists have their own sub directory.
Take a look at the above mentioned URL and compare it to http://www.frutzle.com/aboutsite.asp. The sub-menu is on the left side (can't miss it).
Thanks, Roland
 http://www.frutzle.com |
|
paco
Junior Member
 
Spain
187 Posts |
Posted - 02 November 2001 : 07:55:01
|
Some solutions would be to have one submenu include for each subsite or build the submenu dynamically (ASP)checking in which part of the site you are in so you have all the td's behave the same exept the desired one.
|
 |
|
Roland
Advanced Member
    
Netherlands
9335 Posts |
Posted - 02 November 2001 : 08:38:48
|
Thanks for your reply paco.
I was wondering if it's possible to do something with an if statement that checks the url for a directory. If the directory is in the URL, it should change the bgcolor to white, else it should show it as is.
Of course that would have to be done for all <td>'s but that's a lot less work than having to edit one for each directory.
Could someone tell me if my idea is correct and how I would have to go about doing this (or something with the same result)? I don't know enough about ASP to build something like this myself 
Roland |
 |
|
GauravBhabu
Advanced Member
    
4288 Posts |
Posted - 02 November 2001 : 08:44:14
|
strScriptName = request.servervariables("script_name") if instr(1,strScriptName,"/DIRECTORYNAME/",1)> 0 then Change color end if strScriptName = ""
GauravBhabu There is only one miracle...That is LIFE! | It is difficult to IMPROVE on Perfection, There is no harm in Keep Trying. |
 |
|
Roland
Advanced Member
    
Netherlands
9335 Posts |
Posted - 02 November 2001 : 08:49:28
|
quote:
strScriptName = request.servervariables("script_name") if instr(1,strScriptName,"/DIRECTORYNAME/",1)> 0 then Change color end if strScriptName = ""
GauravBhabu There is only one miracle...That is LIFE! | It is difficult to IMPROVE on Perfection, There is no harm in Keep Trying.
Uhohhh (I think I watched Teletubbies too much )
So I place that in the included file? How does it know which color to change to what color?
Sorry for being such a complete ... well you know... |
 |
|
paco
Junior Member
 
Spain
187 Posts |
Posted - 02 November 2001 : 09:05:26
|
You could have the subsite names in an array and then do something like this:
strScriptName = request.servervariables("script_name") For each subsite
if instr(1,strScriptName,subsite,1)> 0 then
' on this one you don't need onMouseOver or anything as it never changes %> <td bgcolor="#<%=colorSelected%> onClick="goToURL ...><a href="http://www.frutzle.com/lyrics/cats/" id="cats"> </td> else
<td bgcolor="#DFDFDF" onmouseover="mOvr(this,cats);this.style.backgroundColor='#ECECEC'" onmouseout="mOut(this,cats);this.style.backgroundColor='#DFDFDF'" onClick="goToURL('parent','http://www.frutzle.com/lyrics/cats/');return document.returnValue;"><a href="http://www.frutzle.com/lyrics/cats/" id="cats"> </td> end if
next
Not a copy paste solution but I hope it's enough to get the idea
Edited by - paco on 02 November 2001 09:06:34 |
 |
|
GauravBhabu
Advanced Member
    
4288 Posts |
Posted - 02 November 2001 : 09:09:13
|
I don't know which <td> color you want to change and if you want to change all or just one particular. However, If you are using variables for colors then just change the value of variable with new color you want to assign
GauravBhabu There is only one miracle...That is LIFE! | It is difficult to IMPROVE on Perfection, There is no harm in Keep Trying. |
 |
|
Roland
Advanced Member
    
Netherlands
9335 Posts |
Posted - 02 November 2001 : 11:20:30
|
Well I got it working. I know it's probably not the best sollution but I'm an ASP newbie and I'm really glad you guys helped me 'cause I wouldn't have been able to do this without you.
Here's the code (for one item) that I used: <%
strScriptName = request.servervariables("script_name")
if instr(strScriptName,"aerosmith")> 0 then Response.Write("<tr><td bgcolor=#FFFFFF><h1>Aerosmith</td></tr>") else Response.Write("<tr><td bgcolor=#DFDFDF onMouseOver=""mOvr(this,aerosmith);this.style.backgroundColor='#ECECEC'"" onMouseOut=""mOut(this,aerosmith);this.style.backgroundColor='#DFDFDF'"" onClick=""goToURL('parent','http://www.frutzle.com/lyrics/aerosmith/');return document.returnValue;""><a href=""http://www.frutzle.com/lyrics/aerosmith/"" id=""aerosmith"">Aerosmith</a></td></tr>") end if %>
It even works with Netscrap... lol
Again, thank you for you time and patience *bows* |
 |
|
|
Topic  |
|