Results 1 to 4 of 4

Thread: Official way to dyn. change style

  1. #1

    Thread Starter
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032

    Official way to dyn. change style

    What's the "official" way to dynamically/programmically change a HTML element's style via ECMAscript? The Rhino book has IE or Netscape versions, and I can't find exactly what I'm looking for at w3.org.

    Thanks,
    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.

  2. #2
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    Yes, this is something of a pain. The Rhino book covers JavaScript, but it is before the standards.

    There is a single page that I've found at the W3C that helps (sorta): DOM Level 3 Core Specs Appendix E: ECMAScript Language Binding.

    If you have any specific questions, I will try to help.

    In the meantime, I hope this helps (and I hope I got all the syntax correct):

    Code:
    var myObject = document.getElementByID("foo");
    
    myObject.style.backgroundColor = "#0000ff";
    myObject.style.Color = "#ff0000";
    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
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    I was looking for a page like this http://www.w3.org/TR/2001/WD-DOM-Lev...1025/html.html for HTML DOM Level 3, but I guess that's not ready yet.

    That looks similar to what I was doing, but I wasn't sure whether it was correct or just an IE extension (all I really need to support on my intranet is IE 5/6 anyway, but...)

    Thanks,
    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.

  4. #4
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    Yeah, for some reason the standard looks more like the MS extention than the NS originals. *shrug*
    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.

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