Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Apr 2007
    Posts
    179
    Thanks
    17
    Thanked 0 Times in 0 Posts

    <script> language

    I saw a section of the javascript like this:


    <script>

    //Some javascripts here

    </script>


    My questions are:

    1)The language is not specified in the <script> tag. How can the browser know it is a javascript not a VB script?

    2)If the language is not specified in the <script> tag, will the browser assume the defualt langauge is the javascript?


    Thanks

    Scott

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,146
    Thanks
    203
    Thanked 2,547 Times in 2,525 Posts
    Quote Originally Posted by otnj2ee View Post
    My questions are:

    1)The language is not specified in the <script> tag. How can the browser know it is a javascript not a VB script?

    2)If the language is not specified in the <script> tag, will the browser assume the defualt langauge is the javascript?
    1) see 2

    2) Yes, the default is assumed to be JavaScript. But this is not good practice - script blocks should always be defined:-

    <script type = "text/javascript"> or <script type = "text/vbscript">

    The default scripting language in the absence of type or language (deprecated) attributes can be specified by including a META element in the document HEAD, for example:

    <META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
    Last edited by Philip M; 05-16-2007 at 07:42 PM. Reason: Correct spelling


  •  

    Posting Permissions

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