Results 1 to 6 of 6

Thread: JavaScript and CSS Classes

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2001
    Posts
    843

    JavaScript and CSS Classes

    Can you change with code the CSS class of an object after the web page has been downloaded? Does anybody know how?!

    Thank you!
    "The difference between mad and genius is the success"

  2. #2
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    You can in DOM 3. I'm not sure about the current standards.

    www.w3c.org
    developer.netscape.org
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2001
    Posts
    843
    What is DOM 3?!?
    "The difference between mad and genius is the success"

  4. #4
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    Its the Document Object Modal, a way of addressing an element/Tag on a HTML Page.

    If you had this code...

    <body>
    <input type="text" name="text1">
    </body>

    ... you can use the DOM and a scripting language such as Javascript to get the value in the text...

    alert (document.all("text1").value);

    ...This would display a popup msg with the contents or text1.

    document indicates the page your working on
    all("text1") searching all elements on a page until it finds a item named 'text1'. all is only really used in Internet Explorer 4 +, I prefer getElementById but only modern browsers support it
    value returns/sets the value of item

    Check out CiberTHuGs link for more info
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

  5. #5
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Set the "className" attribute of an HTML element.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2001
    Posts
    843
    Thank you... the className works perfect!
    "The difference between mad and genius is the success"

Posting Permissions

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



Click Here to Expand Forum to Full Width