[SOLVED] Showing something on a page - only if they have Javasciprt disabled.

This is a discussion on "[SOLVED] Showing something on a page - only if they have Javasciprt disabled." within the JavaScript Forum section. This forum, and the thread "[SOLVED] Showing something on a page - only if they have Javasciprt disabled. are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #21 (permalink)  
Old Dec 24th, 2007, 15:24
Ed Ed is offline
Highly Reputable Member
Join Date: Jul 2007
Location: Cork, Ireland
Posts: 699
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Showing something on a page - only if they have Javasciprt disabled.

You've lost me.
Last Blog Entry: Happy New Year! (Dec 31st, 2007)

Last edited by Ed; Dec 24th, 2007 at 15:26. Reason: I wrote a bunch of garbage.
Reply With Quote
  #22 (permalink)  
Old Dec 24th, 2007, 15:31
Aso's Avatar
Aso Aso is offline
Chief Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,066
Blog Entries: 2
Thanks: 5
Thanked 32 Times in 29 Posts
Re: Showing something on a page - only if they have Javasciprt disabled.

Even though your doctype is 'XHTML', you are serving the page as 'HTML' (as Mike pointed out). Don't worry about this too much, many people use XHTML doctypes and serve them as HTML (which there is a bit of debate about, but I won't bore you with the details ).
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
Reply With Quote
  #23 (permalink)  
Old Dec 24th, 2007, 15:33
Ed Ed is offline
Highly Reputable Member
Join Date: Jul 2007
Location: Cork, Ireland
Posts: 699
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Showing something on a page - only if they have Javasciprt disabled.

Okay, okay...does this mean I should, or I shouldn't use Swagner's method?

Ed
Last Blog Entry: Happy New Year! (Dec 31st, 2007)
Reply With Quote
  #24 (permalink)  
Old Dec 24th, 2007, 15:34
Aso's Avatar
Aso Aso is offline
Chief Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,066
Blog Entries: 2
Thanks: 5
Thanked 32 Times in 29 Posts
Re: Showing something on a page - only if they have Javasciprt disabled.

It means you can use Swagner's method, as Mike said
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
Reply With Quote
  #25 (permalink)  
Old Dec 24th, 2007, 15:35
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Showing something on a page - only if they have Javasciprt disabled.

Basically, that line of code says to the browser "I am HTML." The browser respects this, and it processes your page as HTML.

Because your page is being processed as HTML, you can use document.write.

If you ever switch to real XHTML, then document.write will break your pages (it breaks well-formedness, which is a strict requirement of XHTML).
Reply With Quote
  #26 (permalink)  
Old Dec 24th, 2007, 15:43
Ed Ed is offline
Highly Reputable Member
Join Date: Jul 2007
Location: Cork, Ireland
Posts: 699
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Showing something on a page - only if they have Javasciprt disabled.

Please don't shoot me!

This was my question before you showed me your method Mike.
I have attempted to implement Swagner's method.

Why doesn't it work here : http://simplifiedimpact.com/beta2.html

HTML: Select all
<script type="text/javascript">
var code = '<h3 class="section"><img src="http://simplifiedimpact.com/WELP.jpg" alt="Welcome" /><a id="toggle" href="#" name="toggle"><img class="imageslide" src="http://simplifiedimpact.com/images57/slidebutton.jpg" alt="Slide" /></a></h3>
<div id="test"><img id="ready" src="http://simplifiedimpact.com/nobinoculars.jpg" alt="Ready?" /><br />
Yes, we design beautiful websites that are extremely simple, yet have some serious impact.<br />
<br />
<br />
<div class="aboutpara"><img src="http://simplifiedimpact.com/aboutus5.jpg" alt="** PLEASE DESCRIBE THIS IMAGE **" /><br />
Simplified Impact is a small web design company based in Cork, Ireland.</div>
</div>';
document.write(code);
</script>
Ed
Last Blog Entry: Happy New Year! (Dec 31st, 2007)
Reply With Quote
  #27 (permalink)  
Old Dec 24th, 2007, 17:28
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Showing something on a page - only if they have Javasciprt disabled.

Quote:
Originally Posted by Vivara View Post
Please don't shoot me!

This was my question before you showed me your method Mike.
I have attempted to implement Swagner's method.
Relax! Don't worry. Gawd, I'm not that much of an ogre, am I?

...on second thoughts, don't answer that question.

I actually think Swagner's method is better than mine.

Quote:
Why doesn't it work here : http://simplifiedimpact.com/beta2.html
You still have errors in your code. The validator thinks that your JS is HTML.

I'm afraid I'm unfamiliar with the vagaries of document.write.

Last edited by MikeHopley; Dec 24th, 2007 at 17:34.
Reply With Quote
  #28 (permalink)  
Old Dec 24th, 2007, 17:43
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Showing something on a page - only if they have Javasciprt disabled.

OK, I see that you're using my idea now. The problem is that when you use document.write, all code needs to be on one line. You can't separate the stuff within the document.write declaration. For example, you can't use this:
Code: Select all
document.write('Some

Text');
It won't work! It must be:
Code: Select all
document.write('Some Text');
So, this means that your script should be:
Code: Select all
<script type="text/javascript">
var code = '<h3 class="section"><img src="http://simplifiedimpact.com/WELP.jpg" alt="Welcome" /><a id="toggle" href="#" name="toggle"><img class="imageslide" src="http://simplifiedimpact.com/images57/slidebutton.jpg" alt="Slide" /><\/a><\/h3><div id="test"><img id="ready" src="http://simplifiedimpact.com/nobinoculars.jpg" alt="Ready?" /><br />Yes, we design beautiful websites that are extremely simple, yet have some serious impact.<br /><br /><br /><div class="aboutpara"><img src="http://simplifiedimpact.com/aboutus5.jpg" alt="** PLEASE DESCRIBE THIS IMAGE **" /><br />Simplified Impact is a small web design company based in Cork, Ireland.<\/div><\/div>';
document.write(code);
</script>
Note that I also added backslashes (\) in front of slashes in closing tags to prevent javascript errors. For example: <\/a>

Hope that helps!
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)

Last edited by Stuart; Dec 24th, 2007 at 17:55.
Reply With Quote
  #29 (permalink)  
Old Dec 24th, 2007, 18:24
Ed Ed is offline
Highly Reputable Member
Join Date: Jul 2007
Location: Cork, Ireland
Posts: 699
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Showing something on a page - only if they have Javasciprt disabled.

Thank You!

You can see what I wanted if you view http://simplifiedimpact.com/beta2.html with JavaScript enabled and disabled. I want to make my site accessible to every user and not just most.

Ed
Last Blog Entry: Happy New Year! (Dec 31st, 2007)

Last edited by Ed; Dec 24th, 2007 at 19:36.
Reply With Quote
  #30 (permalink)  
Old Dec 24th, 2007, 19:00
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: [SOLVED] Showing something on a page - only if they have Javasciprt disabled.

Glad to help! And may I add that your site is great! The sliding effect is really nice!
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Reply With Quote
  #31 (permalink)  
Old Dec 24th, 2007, 19:37
Ed Ed is offline
Highly Reputable Member
Join Date: Jul 2007
Location: Cork, Ireland
Posts: 699
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: [SOLVED] Showing something on a page - only if they have Javasciprt disabled.

Thank You Mike and aso186 as well, it's great that you both have such knowledge!

Ed
Last Blog Entry: Happy New Year! (Dec 31st, 2007)
Reply With Quote
  #32 (permalink)  
Old Dec 24th, 2007, 20:14
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: [SOLVED] Showing something on a page - only if they have Javasciprt disabled.

Hey, that's what the forumz are for!
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[solved] Some images showing up, others not Ohfrikenno Starting Out 2 Apr 5th, 2008 15:24
[SOLVED] CSS boxes not showing in IE6 bulldog Web Page Design 2 Mar 14th, 2008 19:45
page showing different on different screens xkatx21x Web Page Design 5 Oct 26th, 2007 17:52
Showing Current Page with Flash Slider Menu samason Flash & Multimedia Forum 2 Jun 9th, 2007 15:46
Background page not showing up aaronh Web Page Design 4 Apr 30th, 2007 19:30


All times are GMT. The time now is 14:43.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43