Closed Thread Icon

Topic awaiting preservation: Changing div classes. (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=7882" title="Pages that link to Topic awaiting preservation: Changing div classes. (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Changing div classes. <span class="small">(Page 1 of 1)</span>\

 
jiblet
Paranoid (IV) Inmate

From: Minneapolis, MN, USA
Insane since: May 2000

posted posted 10-12-2001 20:30

Okay, so say I have:

<div class="div_h4" name="cf"><a href="http://www.coffman.umn.edu/facilities.html" onMouseOver="hiliteAssoc('cf')">

I want to change the <div> class by means of the hiliteAssoc() function I have defined. I tried document.all('cf').className = value, but that doesn't seem to work (at least in NN6 and IE5Mac).

How do I reference the CSS class of a div in a reasonable subset of browsers?

-jiblet

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 10-12-2001 20:41

My personal favourite is still onmouseover="this.className='classOver'"

It works in NS6+ and IE.

Emps


You're my wife now Dave

jiblet
Paranoid (IV) Inmate

From: Minneapolis, MN, USA
Insane since: May 2000

posted posted 10-12-2001 20:42

It's not a simple rollover. It changes the classes of many elements to show relationships. I left out the hiliteAssoc() function because it is irrelevant to the problem...

-jiblet

[This message has been edited by jiblet (edited 10-12-2001).]

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 10-12-2001 20:44

There's no "NAME" parameter for DIV tags, correct parameter is "ID"...

<div class="div_h4" ID="cf">

Alos, in order for this to work in DOM compatible web browsers (Mozilla/NN6), your function should look something like this:

function yourFunction(layer) {
&nbsp;&nbsp;&nbsp;&nbsp;if (document.getElementById) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.getElementById(layer).property = value;
&nbsp;&nbsp;&nbsp;&nbsp;} else
&nbsp;&nbsp;&nbsp;&nbsp;if (document.all) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.all[layer].property = value;
&nbsp;&nbsp;&nbsp;&nbsp;}
}




[This message has been edited by mr.maX (edited 10-12-2001).]

jiblet
Paranoid (IV) Inmate

From: Minneapolis, MN, USA
Insane since: May 2000

posted posted 10-12-2001 20:45

tx

-jiblet

jiblet
Paranoid (IV) Inmate

From: Minneapolis, MN, USA
Insane since: May 2000

posted posted 10-12-2001 21:32

Cool, well it worked like a charm in IE 5 Mac. Other browsers (NN6 as well as IE 5 & 6 PC) are choking on something else in my JS code. Unfortunately I don't have a PC handy (I have to use co-workers, and they are all busy people), and NN6 is not giving good enough error codes to determine what the problem is. If anyone has some time to check out my JS code on:
http://www.tcsu.umn.edu/sitemap.html

The top image links are rollovers using Docs code, u can tell JS is stalled because those don't work. The data isn't all complete for the page yet, but if you move over the first Facilities link it should change two of the listings to a white background. Like I said it works fine in IE5 Mac, but other browsers are stalling out before they even get to the function definitions. Tell me if you see anything glaring.

-jiblet

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 10-12-2001 21:59

Change:

<SCRIPT LANGUAGE="JavaScript 1.2">

To:

<SCRIPT LANGUAGE="JavaScript1.2">

No space between word "JavaScript" and "1.2".

Also, you have an error in for loop from hiliteAssoc() function. Corrrect loop would be this:

for(i=0; i<links[theIndex].length; i++) { some stuff here }


« BackwardsOnwards »

Show Forum Drop Down Menu