SitePoint Sponsor

User Tag List

Results 1 to 14 of 14
  1. #1
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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
    Attached Files Attached Files

  2. #2
    #titanic {float:none} silver trophy
    molona's Avatar
    Join Date
    Feb 2005
    Location
    from Madrid to Heaven
    Posts
    8,269
    Mentioned
    251 Post(s)
    Tagged
    1 Thread(s)
    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

  3. #3
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks - I have just check using cmd and the file has only 1 extension.

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by mr_pwilliams View Post
    I have attached a zip file with code in inline.html works, inline2.html doesn't.

    I have disabled the JavaScript option on IE8.
    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.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    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>??

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by mr_pwilliams View Post
    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?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  7. #7
    #titanic {float:none} silver trophy
    molona's Avatar
    Join Date
    Feb 2005
    Location
    from Madrid to Heaven
    Posts
    8,269
    Mentioned
    251 Post(s)
    Tagged
    1 Thread(s)
    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?

  8. #8
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by molona View Post
    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.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  9. #9
    #titanic {float:none} silver trophy
    molona's Avatar
    Join Date
    Feb 2005
    Location
    from Madrid to Heaven
    Posts
    8,269
    Mentioned
    251 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    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

  10. #10
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by molona View Post
    Hmm... but the thing is... I don't have that problem. Both of them work for me
    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.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  11. #11
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    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??

  12. #12
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by mr_pwilliams View 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.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  13. #13
    #titanic {float:none} silver trophy
    molona's Avatar
    Join Date
    Feb 2005
    Location
    from Madrid to Heaven
    Posts
    8,269
    Mentioned
    251 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by mr_pwilliams View Post
    This is frustrating as I have just tried this in Firefox and both files work -- aaarrrgghh.

    Should I update to IE9??
    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

  14. #14
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking Thank you

    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


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •