By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,398 Members | 1,372 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,398 IT Pros & Developers. It's quick & easy.

javascript is blocked

P: 3
I'm learning javascript for a web page. The first attempt to simply print "hello world" will not run. I donwload pages that contain javascripts without problem.
Any suggestions would be welcome.

regards
mauken.
Oct 16 '07 #1
Share this Question
Share on Google+
14 Replies


acoder
Expert Mod 15k+
P: 16,027
Welcome to TSDN!

Post your problem code.
Oct 16 '07 #2

Death Slaught
100+
P: 1,137
I'm learning javascript for a web page. The first attempt to simply print "hello world" will not run. I donwload pages that contain javascripts without problem.
Any suggestions would be welcome.

regards
mauken.
try this:

[HTML]<html>
<head>
<script language="JavaScript"
type="text/javascript">
document.write("Hello World");
</script>
<noscript>
Hello World
</noscript>
</head>
</html>[/HTML]

Hope it helps, Death
Oct 16 '07 #3

P: 3
Thanks for your answer. (death)
I tried your example and it printed hello world 1 time. I expected hello world to show 2 times.
I get this message - to help protect your security internet explorer has restricted this file from showing active content that could access your computer. click here for options. I click allow blocked content - from the pop up window. but have no success. I've been unable to find the setting that would allow scripts.

regards
mauken
Oct 17 '07 #4

acoder
Expert Mod 15k+
P: 16,027
I tried your example and it printed hello world 1 time. I expected hello world to show 2 times.
This is probably because it's showing the noscript part.
I get this message - to help protect your security internet explorer has restricted this file from showing active content that could access your computer. click here for options. I click allow blocked content - from the pop up window. but have no success. I've been unable to find the setting that would allow scripts.
What version of IE are you using? Have you tried other browsers?
Oct 17 '07 #5

Death Slaught
100+
P: 1,137
Thanks for your answer. (death)
I tried your example and it printed hello world 1 time. I expected hello world to show 2 times.
I get this message - to help protect your security internet explorer has restricted this file from showing active content that could access your computer. click here for options. I click allow blocked content - from the pop up window. but have no success. I've been unable to find the setting that would allow scripts.

regards
mauken
The example I provided is ment to print it only one time (unless you edited it).

If you would like for it to print it twice I would do this:

[HTML]<html>
<head>
<script langauge="JavaScript"
type="text/javascript">
document.write("Hello World, Hello World!");
</script>
<noscript>
Hello World, Hello World!
</noscript>
</head>
</html>[/HTML]

Allow me to explain what I did:

Document.write literally writes the text on the document, but you must have JavaScript enabled on your computer. I think your JavaScript is turned off, which is where the noscript comes in.

noscript is for computers with JavaScript turned off, or that can't use JavaScript.


Thanks, Death
Oct 17 '07 #6

Death Slaught
100+
P: 1,137
Just now noticed you said you don't know how to turn it on (that is if it's off to begin with).


Tools, Internet Options, Security, Internet Zone, Custom Level, Scripting, Active Scripting, Enable.


That's how you do it in IE 6.0, I think it's the same in 7.0 not sure.

- Death

Note - Turning JavaScript on is great, but only durring testing/programming. However having it on can harm your computer, so just be sure to turn it back off when your finished. Also turning it off doesn't really make your browser incapable of using JavaScript you simply have to allow the active X control that should show up at the top of the screen.

PS - If you have any more problems scripting wise please try it yourself and then post your code ( I wasn't supossed to just give you the answer like I did (sorry mods) but I was in a hurry and wasn't really thinking).
Oct 17 '07 #7

P: 3
thanks again (death)
Your second reply should get started with javascript.

regards
mauken
Oct 18 '07 #8

acoder
Expert Mod 15k+
P: 16,027
Note - Turning JavaScript on is great, but only durring testing/programming. However having it on can harm your computer, so just be sure to turn it back off when your finished. Also turning it off doesn't really make your browser incapable of using JavaScript you simply have to allow the active X control that should show up at the top of the screen.
JavaScript is safe, it's ActiveX which is dangerous.
PS - If you have any more problems scripting wise please try it yourself and then post your code ( I wasn't supossed to just give you the answer like I did (sorry mods) but I was in a hurry and wasn't really thinking).
A simple test script like that is fine, but you're right about making an attempt first.
Oct 18 '07 #9

acoder
Expert Mod 15k+
P: 16,027
[HTML]<html>
<head>
<script langauge="JavaScript"
type="text/javascript">
document.write("Hello World, Hello World!");
</script>
<noscript>
Hello World, Hello World!
</noscript>
</head>
</html>[/HTML]
I would just like to point out that the language attribute is deprecated, just use the type attribute only.
Oct 18 '07 #10

Death Slaught
100+
P: 1,137
I would just like to point out that the language attribute is deprecated, just use the type attribute only.
I know that it's deprecated, but some of the older browsers need it, and I wasn't sure how far back he was going.


Thanks, Death
Oct 18 '07 #11

Death Slaught
100+
P: 1,137
JavaScript is safe, it's ActiveX which is dangerous.
A simple test script like that is fine, but you're right about making an attempt first.
Sorry that's what I ment to say I was at school when I type it so I was in a hurry.

Thanks, Death
Oct 18 '07 #12

Death Slaught
100+
P: 1,137
thanks again (death)
Your second reply should get started with javascript.

regards
mauken
Np it's what I'm here for, but just make sure to read over acoders post, he knows alot more about JavaScript ( and probably every other langauge ), than I do, he gives great advice too.

Thanks, Death
Oct 18 '07 #13

acoder
Expert Mod 15k+
P: 16,027
I know that it's deprecated, but some of the older browsers need it, and I wasn't sure how far back he was going.
Even for older browsers, you can probably safely omit the language attribute going by this link:
In the absence of the LANGUAGE attribute, browsers that do not support the TYPE attribute typically assume that the language is the highest version of JavaScript supported by the browser. Thus authors may safely omit the deprecated LANGUAGE attribute when using JavaScript.
Oct 18 '07 #14

Death Slaught
100+
P: 1,137
Even for older browsers, you can probably safely omit the language attribute going by this link:
Thanks, but I don't use it any ways I was just going by something I read in a book about certain older browsers need the langauge attribute present......guess not.


Thanks, Death

PS - WOOT! 7 hours of school and this is the first thing i've learned all day!
Oct 18 '07 #15

Post your reply

Sign in to post your reply or Sign up for a free account.