type property (script)
Sets or retrieves the type of scripting language to use.
In some older browsers the value of this property must be set, because there is no default value for this property.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read/write.
HTML page for this property: type |
Possible values:
String that sets or retrieves the type of scripting language.
One of the following values:
The language is ECMAScript. | |||||||
The language is JavaScript. | |||||||
The language is Microsoft JScript. | |||||||
Same as text/vbscript. | |||||||
The language is Microsoft Visual Basic Scripting Edition. | |||||||
The language is XML. |
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the type attribute:
|
|||||
<head> <script type="text/javascript" src="javascript.js"></script> </head> <body> <button onclick="HelloWorld ();">Call HelloWorld function</button> </body> |
|||||
|
|||||
Did you find this example helpful?
|
Example HTML code 2:
This example illustrates the use of the type property:
|
|||||
<head> <script type="text/javascript" id="baseScript" src="javascript.js"></script> <script type="text/javascript"> function GetScriptType () { var script = document.getElementById ("baseScript"); alert ("The type of the first script: " + script.type); } </script> </head> <body> <button onclick="GetScriptType ();">Get the type of the first script!</button> <button onclick="HelloWorld ();">Call HelloWorld function</button> </body> |
|||||
|
|||||
Did you find this example helpful?
|
Supported by objects:
HTML elements:
Related pages:
External links:
User Contributed Comments