Hey all. For a website that I'm constructing for a school project (lucky me, huh?), I'll be using HTML5 (not best practice, but please don't rip me for it). In order to enable HTML5, I'm running the HTML5 shiv Javascript plug-in hosted by Google. Therefore, I want to display a message saying 'You need to have Javascript enabled for this to work. Accept the message at the top of your screen please.' if Javascript is not enabled, and then have it disappear if it's enabled.

The way that I want to do it is this:

I'll make a paragraph of text displaying the message. Upon enabling the Javascript, a separate script that adds a display:none declaration to the paragraph will run. Problem is, I can't do that with my limited abilities.

Help please.

Thanks.~TehYoyo

TechnoBear
—
2012-03-06T17:31:15Z —
#2

TehYoyo said:

Hey all. For a website that I'm constructing for a school project (lucky me, huh?), I'll be using HTML5 (not best practice, but please don't rip me for it). In order to enable HTML5, I'm running the HTML5 shiv Javascript plug-in hosted by Google. Therefore, I want to display a message saying 'You need to have Javascript enabled for this to work. Accept the message at the top of your screen please.' if Javascript is not enabled, and then have it disappear if it's enabled.

You might want to rethink that message. There are people who - for whatever reason - might not be able to enable JavaScript, as well as those who choose not to. If I came across a message saying 'You need to have Javascript enabled for this to work', I'd probably just leave the site. Try something a bit more cajoling - like "To see our site at its best, please enable JavaScript". Because it will still be accessible without JavaScript, won't it?

The easiest way to display something where JavaScript is not enabled would be to use <noscript>. I'm guessing you could use CSS to position the message wherever you choose, but I can't say I've ever done this. I don't use HTML5.

TehYoyo
—
2012-03-06T20:35:24Z —
#3

Yeah...I'm rethinking my fascination with HTML5...it's probably (actually, it's definitely) not a good idea to use it for every website...

Thanks.

~TehYoyo

Oh hey! Grats on 1000 posts!

TechnoBear
—
2012-03-07T13:31:41Z —
#4

TehYoyo said:

Yeah...I'm rethinking my fascination with HTML5...it's probably (actually, it's definitely) not a good idea to use it for every website...

I wouldn't argue with that. Better to use something that already works, rather than something that only works with JavaScript now, but might work sometime in the future, provided the specs don't change too much in the meantime.

TehYoyo said:

Oh hey! Grats on 1000 posts!

Thank you. I actually reached that number replying to another of your threads. Of course, it isn't quantity that matters but quality - and you can't judge that without reading them all. :lol:

xhtmlcoder
—
2012-03-07T13:49:34Z —
#5

General Discussion posts don't count towards that total number they have zero weight else my actual 'Posts:' count would be far higher, etc.

Like was said as a general rule you are better off using a normative markup language. Remember your teachers will be marking the work so need to understand it too. As Fred is experimental that would be hard to quantify regarding any useful semantics.

Typically the more elegant code; is that, which is already richly semantic exists and works, is in the form of HTML 4.01 or XHTML 1.0 and is "fit for purpose" thus wouldn't need JS - just to render - or would work as efficiently without it.