Solved

Works in Mozilla - Not in IE6 - .className =

Posted on 2004-03-22
6
1,940 Views
Last Modified: 2008-03-17
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
}
0
Comment
Question by:Geoff Millikan
  • 2
  • 2
  • 2
6 Comments
 
LVL 25

Expert Comment

by:devic
ID: 10654351
<script>
window.onload=function (){document.getElementById('topmenu-dsl').className = "topmenuroll"}
</script>
0
 

Author Comment

by:Geoff Millikan
ID: 10654451
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>
--------------------------------------------------------------
0
 
LVL 25

Expert Comment

by:devic
ID: 10654492
add this :)

<table id=a><td> where is object with id=a???</td></table>
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 12

Accepted Solution

by:
lil_puffball earned 150 total points
ID: 10654563
Try changing this:

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

to this:

switch (arrURL[arrURL.length-2]){
case 'dsl':
//Nested DSL Switch
switch (arrURL[arrURL.length-1]){
0
 

Author Comment

by:Geoff Millikan
ID: 10654943
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.)
0
 
LVL 12

Expert Comment

by:lil_puffball
ID: 10655072
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. :)
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question