SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    239
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Opinion wanted on extent of use of scripts for site layout

    I usually layout my sites with divs for title, menu, content (all in a wrapper div) so I can have site-wide structure, css menus, style, graphics etc.

    Standard css stuff basically.

    I'm just re-jigging things and something occurred to me, and this may be obvious to some of you but I'd never thought about it before.

    Why not use JavaScript to render the div tags as well?

    That way the only thing that's in the html are declarations to scripts and the actual content text and image tags. I realise this is one step away from scripting the whole thing including content (but I don't want to have content brought in from a database just yet) and I was wondering how widespread this practice is.

    Thoughts?

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by SubEffect View Post
    Thoughts?
    A number of reasons not to are:
    • people who have deliberately disabled scripting for security reasons
    • people who work where scripting is disabled due to work-place policy
    • people who are disabled and are using technology that doesn't support scripting
    • low-tech cell phones with internet support but no scripting
    • search engines also ignore scripting too


    In all of those cases, you end up finding that scripted content might as well not exist.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    239
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    So, err, what is the point of JavaScript then? AJAX?

    ??confused??

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by SubEffect View Post
    So, err, what is the point of JavaScript then? AJAX?

    ??confused??
    Ajax is built on top of JavaScript, so the same issues apply.

    The most effective way to use JavaScript, it to use it to enhance the user's experience.

    When you get to a point where what you're doing just won't work without JavaScript, you then find that your potential audience decreases due to the factors listed above.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Enthusiast
    Join Date
    Feb 2011
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Javascript should be an add on to make bells and whilstles for a site. The site should function without it, think of it as an extra thing for those who have it enabled.

    Like air con. You need to make a car first, air con is an added extra, but some people like it.


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
  •