Jump to content

XHTML/JavaScript Get around <noscript>


RRRSystems

Recommended Posts

Hello,

 

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>

 

Thanks,

Raney

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

Thanks,

 

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 comment
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 comment
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.

 

http://www.w3.org/html/wg/tracker/issues/117?changelog

 

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 comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...