...

View Full Version : <script> language



otnj2ee
05-16-2007, 06:58 PM
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

Philip M
05-16-2007, 07:15 PM
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">



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum