?
Solved

Works in Mozilla - Not in IE6 - .className =

Posted on 2004-03-22
6
Medium Priority
?
1,956 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 12

Accepted Solution

by:
lil_puffball earned 600 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…
Suggested Courses

840 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