New to this language and new help

Hi,

I am learning JavaScript at the moment and using a book to do it.

I the first example in the book I need to disable JavaScript to look at the <script> and <noscript> tags.

I have downloaded the examples from the website and it works. However, when I try to type in the code myself (or copy and paste) and save the file using Notepad the code does not work.

I have attached a zip file with code in inline.html works, inline2.html doesn’t.

I have disabled the JavaScript option on IE8.

Any ideas

Does notepad save it with double extension? It is a typical silly mistake that we all do if we don’t pay attention. You don’t see that the file type is txt and simply give it a name (myfile.js). After that… well, the file is really named myfile.js.txt because you didn’t change the file type :slight_smile:

Thanks - I have just check using cmd and the file has only 1 extension.

Can you please expand on what you mean when you say that it doesn’t work?
The inline.html and inline2.html files both seem to work for me with no trouble at all.

When I run in-line1 it reports that JavaScript not running - as in the <noscript> tag. But when I run inline2 the <script> tag works but not the <noscript>??

The only difference that I see between inline.html and inline2.html is that in inline.html one of the messages ends with an exclamation mark, while in inline2.html it doesn’t.

Am I missing something here?

I assume that the expected behaviour is that I’m supposed to have an alert message saying that the document loaded… also, when I get the “Hello World” message in both cases (JavaScript enabled) and the “JavaScript not enabled” message if I deactivate it. It means that it works fine for me (FF 3.6.10 in Windows 7)

Now, if you’re using IE, for security reasons IE in different versions disable scripting and it shows a little bar at the top telling you that a script has been stopped. You need to click on the bar to see the options and decide if you want to enable JavaScript or not. Once you’ve done that, it works perfectly.

So my next question is… are you using IE? Which version? Do you get the little bar at the top?

The oddity here too is “code in inline.html works, inline2.html doesn’t” which would be interesting to find out more about too, given their near-identical similarities. Literally, " !" is in the text of one, and not in the other.

Hmm… but the thing is… I don’t have that problem. Both of them work for me :smiley:

That’s right, works for me too - which seems to indicate that the OP’s experiences are with code that’s different from that which has been reported in the inline/inline2 files that were attached to the post.

This is frustrating as I have just tried this in Firefox and both files work – aaarrrgghh.

Should I update to IE9??

I’ve tried it out using IETester in IE8, and things seem to work there too.

Could it be a cached version of an older page that’s causing the issue for you?
You can use Ctrl+F5 to force IE to load an uncached version of the page.

well, yes and no… in this particular case, it shouldn’t matter which version you use. I was using IE8 and FF3.6 because that’s what I have at the office right now. I could test it later on IE 6 (I have one computer with IE6 at home.

But it is good to have a copy of the newest version for browsing… so in that case, yes :slight_smile:

Thank you for all your help.

I took the code home and tried it in the house and it worked. Does not explain why it didn’t work whilst in work. Perhaps I will still to FireFox whilst at work.

Thank you all