Link to home
Start Free TrialLog in
Avatar of Geoff Millikan
Geoff MillikanFlag for United States of America

asked on

Works in Mozilla - Not in IE6 - .className =

Here's the URL:

http://www.t1shopper.com/dsl/index.shtml

The first navigation button, "DSL", should be yellow, not blue.  What am I missing?  The small scetion of the suspected area of the script is below.  The style sheet is below however, it validates so I don't think there's anything wrong there.

<head>
<script language="JavaScript1.2" type="text/JavaScript"><!--
document.getElementById('topmenu-dsl').className = "topmenuroll"
//--></script>
</head>

<body>
<a href="http://www.t1shopper.com/" id="topmenu-dsl"  class="topmenu">DSL</a>
</body>


.topmenuroll{
      background: #E5C350;
      color : #333333;
      display: block;
      font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
      font-weight : bold;
      font-size : 13px;
      line-height : 13px;
      text-decoration : none;
      width: 120px;
      border-top: 1px solid #FFFFFF;
      border-right: 1px solid #FFFFFF;
      border-left: 1px solid #FFFFFF;
      padding: 4px 4px 4px 6px
}
Avatar of devic
devic
Flag of Germany image

<script>
window.onload=function (){document.getElementById('topmenu-dsl').className = "topmenuroll"}
</script>
Avatar of Geoff Millikan

ASKER

I should have said I'm already calling the function like this: <body onLoad="navcolor();">  Sorry about that everyone.  So the script above should read: or check the URL at  http://www.t1shopper.com/dsl/index.shtml
------------------------------------------------------------
<head>
<script language="JavaScript1.2" type="text/JavaScript"><!--
function navcolor(){
document.getElementById('topmenu-dsl').className = "topmenuroll"
}
//--></script>
</head>

<body onLoad="navcolor();">
<a href="http://www.t1shopper.com/" id="topmenu-dsl"  class="topmenu">DSL</a>
</body>
--------------------------------------------------------------
add this :)

<table id=a><td> where is object with id=a???</td></table>
ASKER CERTIFIED SOLUTION
Avatar of lil_puffball
lil_puffball
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
devic - not sure where you were going with the id in the table tag?

lil_puffball -  Yes, that was it.  It's strage that Mozilla works just fine counting from string orgination (left to right) and IE6 requires counting from string termination to string origin (right to left).  These browser incompatibility issues never cease to amaze me.

Thank you all!  (And points go to lil_puffball because that solution worked and was easy to understand.)
Glad to help. Thanks for the points! :)

And just for further clarification:

In IE, the arrURL breaks up http://www.t1shopper.com/dsl/index.shtml into the following pieces:

http:
www.t1shopper.com
dsl
index.shtml

so arrURL[3] would be index.shtml, not dsl, and arrURL[4] would be undefined.
At first I was going to suggest using

switch (arrURL[2]){
case 'dsl':
//Nested DSL Switch
switch (arrURL[3]){

but later decided to start counting from the end because that would always work, no matter how many folders you have. :)