Jump to content

XHTML/JavaScript Get around <noscript>

Recommended Posts



I am switching from HTML to XHTML and would like to have the same functionality of my <noscript> tag.


I have been trying all day to get this to work (like Brady and the Patriots) but nothing seems to work.


Any help before the game?


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <script type = "text/javascript"> window.onload = function() { document.getElementByID("Content").style.display = "inline"; document.getElementByID("Footer").style.display = "inline"; document.getElementByID("NoScript").style.display = "none"; } </script></head><body> <div id = "Header">My Header Stuff.</div> <div id = "Content" style = "display: none;">My Content Stuff.</div> <div id = "Footer" style = "display: none;">My Footer Stuff.</div> <div id = "NoScript" style = "display: inline;">My NoScript Stuff.</div></body></html>




Edited by RRRSystems...
Link to post
Share on other sites



That did the trick.


I have read that <noscript> is not supported, but it seems to work, just thought I would try to follow the rules.


Now I have to see what the Search Engines think of hidden <div>'s.


Thanks again,

I could have looked at it all day and not seen the error.

Raney the dyslexic programmer.

Link to post
Share on other sites

<noscript> is considered "depreciated" in XHTML's eyes, however "XHTML 1.0 Transitional" will allow depreciated elements. That's why it still works.


aside from supporting more elements,transitional is still like strict XHTML, in that it still requires that you follow all the clean coding practices (properly nested tags, all lowercase, etc.)

Link to post
Share on other sites

I don't really see the point of noscript, nor do I understand the whining about how noscript encourages bad practice.




I think this issue has been discarded by webdevelopers who refuse to waste time developing fall-back functionality for the paranoid people who turn Javascript off.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...