Insert a JavaScript in an HTML page:
The <script> tag is used to define a client-side script, such as a JavaScript.
The script element either contains scripting statements or it points to an external script file through The source attribute.
The required type attribute specifies the MIME type of the script.
Common uses for JavaScript are image manipulation, form validation, and dynamic changes of content.
The <script> tag is supported in all major browsers.
HTML 4 and XHTML deal different with the content inside scripts:
This means that in XHTML, all special characters should be encoded or all content should be wrapped inside a CDATA section.
To ensure that a script parses correctly in an XHTML document, use the following syntax:
Hint: Also look at the noscript element for users that have disabled scripts in their browser or have a browser that doesn�t support client-side scripting.
DTD indicates in which HTML 4.01/XHTML 1.0 DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
The <script> tag does not support any standard attributes.
More information about Standard Attributes.
The <script> tag does not support any event attributes.
More information about Event Attributes.
Your Query was successfully sent!