...

View Full Version : className; class 'over'; general RTFM problems



Roy Gardiner
03-17-2005, 02:32 PM
this.className+=" over";
.
.
this.className=this.className.replace(" over", ""); Either applying or removing the class 'over' from the current item, OK so far. But the HTML code does not have the class 'over' defined anywhere, so I'm now stuck.

Perhaps it's a class in IE's default style sheet; but I'm not even sure how to go about finding out. Is this correct, or am I once again missing something fundamental?

I have yet to find a manual (on-line or a book) with a comprehensive index where I might find out. This is a general problem, I attempt to look something up and no book has an index entry :mad:. Suggestions welcome.

jbot
03-17-2005, 02:44 PM
Roy, what are you trying to do - replace a style class of an element. that's easy, you're just making it complicated.

can we see all your code, please?

Roy Gardiner
03-17-2005, 03:02 PM
Roy, what are you trying to do - replace a style class of an element. that's easy, you're just making it complicated.

can we see all your code, please? Sorry, I explained badly; this is not code I've written, it's code I'm reading and attempting to understand. I've snipped out two statemtents from within loops to post, and I (think I) have it but for the fact that the 'over' class is not defined anywhere in the code or HTML. Either that or my understanding is, as usual, more broken than I thought.

But I'll post the code if you'd like to see it, of course.

jbot
03-17-2005, 03:12 PM
if there's no style class called "over" then the script will return "undefined" when it tries to access it, unless, of course, there's any exception handling which seems to be absent by the sound of it.

anyways, to change a class all you need to do is just rename it, like so:


object.className = "newclass";

to remove a class altogether, do this:


object.removeAttribute ("oldclass");

ok :)

Roy Gardiner
03-17-2005, 03:23 PM
OK I do need to post the code because I'm obviously looking in the wrong place. I'll cut it down to the minimum and post, thanks for your help.

.... :mad: :mad: and as I do so I find the piece of code I'm looking for, strewth wasting everyone's time again, sorry... :(

jbot
03-17-2005, 03:25 PM
OK I do need to post the code because I'm obviously looking in the wrong place. I'll cut it down to the minimum and post, thanks for your help.

no problem. fire away.

Roy Gardiner
03-17-2005, 03:30 PM
jbot is not receiving PMs so please accept (jbot and everyone) my apologies for wasting your time.

jbot
03-17-2005, 04:20 PM
jbot is not receiving PMs so please accept (jbot and everyone) my apologies for wasting your time.

well, just post here instead. what's the problem with that.

oh, yeah, see you've actually fixed it now. oh well ...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum