Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Jan 2004
    Location
    London, England
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    className; class 'over'; general RTFM problems

    Code:
    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 . Suggestions welcome.

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?
    *keep it simple (TM)

  • #3
    New Coder
    Join Date
    Jan 2004
    Location
    London, England
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by jbot
    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.

  • #4
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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:

    Code:
    object.className = "newclass";
    to remove a class altogether, do this:

    Code:
    object.removeAttribute ("oldclass");
    ok
    *keep it simple (TM)

  • #5
    New Coder
    Join Date
    Jan 2004
    Location
    London, England
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

    .... and as I do so I find the piece of code I'm looking for, strewth wasting everyone's time again, sorry...
    Last edited by Roy Gardiner; 03-17-2005 at 03:26 PM.

  • #6
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Roy Gardiner
    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.
    *keep it simple (TM)

  • #7
    New Coder
    Join Date
    Jan 2004
    Location
    London, England
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts
    jbot is not receiving PMs so please accept (jbot and everyone) my apologies for wasting your time.

  • #8
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Roy Gardiner
    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 ...
    Last edited by jbot; 03-17-2005 at 04:51 PM.
    *keep it simple (TM)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •