SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Feb 2002
    Location
    detroit
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    This is fine, but...

    These comments are in regards to the SitePoint.com article 'Rough Guide to the DOM - Part 1'.

    I understand this is all done to show how the new DOM can work, but why would anybody go through this rigamarole just to change a DIV's style when they could do just the same by modifying a style sheet? Can anybody provide a real-world application of why someone would do this?
    Last edited by seanf; Sep 12, 2002 at 09:40.

  2. #2
    morphine for a wooden leg randem's Avatar
    Join Date
    Jun 2002
    Location
    .chicago.il.us
    Posts
    957
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: This is fine, but...

    Originally posted by dinomentia
    I understand this is all done to show how the new DOM can work, but why would anybody go through this rigamarole just to change a DIV's style when they could do just the same by modifying a style sheet? Can anybody provide a real-world application of why someone would do this?
    Manipulation of the DOM allows you to change far more than just a style property on a <div>. In the examples listed in that article were also functions that change actual contents of an HTML element.

    Furthermore, you can't really change a stylesheet on-the-fly. If you want the page to change (ie: DHTML) you have to use the DOM.
    ----Adopt-a-Sig----
    Your message here!

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Location
    northern Maine
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Re: This is fine, but...

    Originally posted by randem
    Furthermore, you can't really change a stylesheet on-the-fly. If you want the page to change (ie: DHTML) you have to use the DOM.
    Why not use the DOM to change the stylesheet on the fly?
    Ever heard of the DOM2 StyleSheets and DOM2 CSS implementations?
    Jason - Contact Me
    Supermoderator @ CodingForums

  4. #4
    morphine for a wooden leg randem's Avatar
    Join Date
    Jun 2002
    Location
    .chicago.il.us
    Posts
    957
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Re: Re: This is fine, but...

    Originally posted by jkd
    Why not use the DOM to change the stylesheet on the fly?
    Ever heard of the DOM2 StyleSheets and DOM2 CSS implementations?
    Pay very close attention to my language:
    A stylesheet is a text file read by the client (browser). For obvious reasons, clients (browsers) can't alter files on the server. Therefore, no amount of DOM manipulation will change the stylesheet. Using DOM, you can modify the client's memory-resident interpretation of the style sheet, but make no mistake: when you return to that site, it will be the same stylesheet it was the first time, and you'll have to change it again.
    ----Adopt-a-Sig----
    Your message here!

  5. #5
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Location
    northern Maine
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Re: This is fine, but...

    Randem, I interpretted exactly what you said:

    Originally posted by randem
    Furthermore, you can't really change a stylesheet on-the-fly.
    on-the-fly in a web environment inherently implies client-side interaction, as only client-side scripting can change a document (in memory) without reloading it, hence "on-the-fly"; unless of course you also consider serving dynamically-generated pages (via some server side language) as "on-the-fly" as well (which is arguable and inconsistent usage of terms).
    Jason - Contact Me
    Supermoderator @ CodingForums


Bookmarks

Posting Permissions

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