javascript is blocked

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mauken
    New Member
    • Oct 2007
    • 3

    javascript is blocked

    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.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Welcome to TSDN!

    Post your problem code.

    Comment

    • Death Slaught
      Top Contributor
      • Aug 2007
      • 1137

      #3
      Originally posted by mauken
      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="JavaS cript"
      type="text/javascript">
      document.write( "Hello World");
      </script>
      <noscript>
      Hello World
      </noscript>
      </head>
      </html>[/HTML]

      Hope it helps, Death

      Comment

      • mauken
        New Member
        • Oct 2007
        • 3

        #4
        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

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          Originally posted by mauken
          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.
          Originally posted by mauken
          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?

          Comment

          • Death Slaught
            Top Contributor
            • Aug 2007
            • 1137

            #6
            Originally posted by mauken
            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="JavaS cript"
            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

            Comment

            • Death Slaught
              Top Contributor
              • Aug 2007
              • 1137

              #7
              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).

              Comment

              • mauken
                New Member
                • Oct 2007
                • 3

                #8
                thanks again (death)
                Your second reply should get started with javascript.

                regards
                mauken

                Comment

                • acoder
                  Recognized Expert MVP
                  • Nov 2006
                  • 16032

                  #9
                  Originally posted by Death Slaught
                  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.
                  Originally posted by Death Slaught
                  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.

                  Comment

                  • acoder
                    Recognized Expert MVP
                    • Nov 2006
                    • 16032

                    #10
                    Originally posted by Death Slaught
                    [HTML]<html>
                    <head>
                    <script langauge="JavaS cript"
                    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.

                    Comment

                    • Death Slaught
                      Top Contributor
                      • Aug 2007
                      • 1137

                      #11
                      Originally posted by acoder
                      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

                      Comment

                      • Death Slaught
                        Top Contributor
                        • Aug 2007
                        • 1137

                        #12
                        Originally posted by acoder
                        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

                        Comment

                        • Death Slaught
                          Top Contributor
                          • Aug 2007
                          • 1137

                          #13
                          Originally posted by mauken
                          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

                          Comment

                          • acoder
                            Recognized Expert MVP
                            • Nov 2006
                            • 16032

                            #14
                            Originally posted by Death Slaught
                            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:
                            Originally posted by HTMLHelp
                            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.

                            Comment

                            • Death Slaught
                              Top Contributor
                              • Aug 2007
                              • 1137

                              #15
                              Originally posted by acoder
                              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......gu ess not.


                              Thanks, Death

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

                              Comment

                              Working...