Forum Moderators: not2easy

Message Too Old, No Replies

What is this class in Web site menu code?

         

may_hem1

10:57 pm on Aug 24, 2003 (gmt 0)

10+ Year Member



Hi, could you please help me decipher this Web site menu code?

<td><a href="http://www.mysite.com" class="menulink" class=&{ns4class};>Click here</a></td>

I understand that I have to look in the style sheet for the class called "menulink", and this is ok, but what is the "ns4class"? I didn't find that listed in the style sheet.

Thanks for your help,

May

hafnius

12:30 am on Aug 25, 2003 (gmt 0)

10+ Year Member



HI may_hem1

Hmmm looks weird. i think it is safe to assume that "ns4" stands for netscape 4.x. Besides not being valid html i think the browser will render the first class and ignore the second.

The idea must be to serve different styles depending on browser, but there must be some browser detection in place. to complement this since it cant work by itself. Its not a very pretty solution, but i dont now how it works.

Kind Regards
Hafnius

mossimo

12:36 am on Aug 25, 2003 (gmt 0)

10+ Year Member



I have never seen this before so I did a quick test using NS4 and here’s what I found.

CSS compliant browsers render the class "menulink" normally.
CSS deficient browsers like NS4 completely ignored the class "menulink".

It seems the presence of class=&{ns4class} cancels out the class="menulink".

If any one knows the mechanics of how this works let us know.

MonkeeSage

12:46 am on Aug 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I believe that mossimo is correct that declaring the class twice cancels out the first instance and uses the second, but I'm also not sure what the value means.

I do know that it follows the syntax of a calling a character entity, e.g., "&amp;" (where "amp" is the entity)...so mabye they have a custom DTD with "{ns4class}" defined as an entity in it.

Jordan

netcommr

1:04 am on Aug 25, 2003 (gmt 0)

10+ Year Member



is the page rendered dynamically from the server or a static page, could be just a code error in the scripting...

mossimo

1:46 am on Aug 25, 2003 (gmt 0)

10+ Year Member



I don't know where “may_hem1” originally found this but my test was on a static html page.

Also I don’t think this was a code error

I think {ns4class} is just a note and class=& is a trigger that causes NS4 to throw out all defined classes in the link or where ever it’s used.

NS4 is the only older browser I have installed so I don’t know if this is effective in other browsers.

Try the code bellow in a CSS deficient browser and you can see its effectiveness.

<html>
<head>
<style type="text/css">
<!--
A.menulink {
display: block;
width: 198px;
text-align: left;
text-decoration: none;
font-family:arial;
font-size:12px;
color: #000000;
BORDER: none;
border: solid 1px #FFFFFF;
}
A.menulink:hover {
border: solid 1px #6100C1;
background-color:#F0E1FF;
}
-->
</style>
</head>
<body>
<table width=200>
<tr>
<td width="100%"><a href="#" class="menulink" class=&{ns4class};>Link</a></td>
</tr>
<tr>
<td width="100%"><a href=#" class="menulink" class=&{ns4class};>Link</a></td>
</tr>
</table>
<br>
<table width=200>
<tr>
<td width="100%"><a href="#" class="menulink";>Link</a></td>
</tr>
<tr>
<td width="100%"><a href="#" class="menulink";>Link</a></td>
</tr>
</table>
</body>
</html>