Solved

Works in Mozilla - Not in IE6 - .className =

Posted on 2004-03-22
6
1,933 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

759 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now