Gazing into my crystal ball I observed JD <us**@example.n et> writing in
news:40******** *****@individua l.net:
Spartanicus wrote: JD <us**@example.n et> wrote:
Is it OK to have empty class attribute values, such as
<href="url " class="">link</a> ?
Why?
I have an ASP function that draws a links menu for a dozen pages. The
function determines which page is calling the function and assigns a
CSS class to that page's link to make it bold. For this to work, the
function dims a bunch of variables and assigns empty strings to each,
then does a conditional statement to assign the "selected" CSS class to
the calling page's link.
So the user's browser ends up with:
<li><a href="url" class="">link</a></li>
<li><a href="url" class="">link</a></li>
<li><a href="url" class="selected ">link</a></li> <li><a href="url"
class="">link</a></li>
The page is not mine and the CSS is too messy to start changing, but
still I'm wondering if this is OK or whether I should re-code the
function?
HTML:
<ul id="navlist">
<li><%=navlist( "page.asp","Pag e Name")%></li>
</ul>
ASP:
<% function navlist(link,do cument)
if instr(link,"?") then
newlink = left(link,instr (link,"?")-1)
theending = mid(link,instr( link,"?"))
else
newlink = link
end if
if instr(request.s ervervariables( "script_name"), newlink) > 0 then
navlist = "<span>" & document & "</span>"
else
navlist = "<a href=" & chr(034)
if instr(link,"?") > 0 then
navlist = navlist & newlink & theending
else
navlist = navlist & link
end if
navlist = navlist & chr(034) & ">" & document & "</a>"
end if
end function
%>
CSS (change to suit):
#navlist li span {background-color:blue; color:white}
#navlist li a {background-color:white; color:blue}
--
Adrienne Boswell
http://www.cavalcade-of-coding.info
Please respond to the group so others can share