HTML Script

JavaScript makes HTML pages more dynamic and interactive.


Online Examples

Insert a script

How to insert a script into an HTML document.

Use <noscript> tag
How to deal with does not support scripting or disable the browser script.

HTML <script> Tag

The <script> tag is used to define client-side scripts, such as JavaScript.

The <script> element can either contain script statements or point to an external script file through the src attribute.

JavaScript is most commonly used for image manipulation, form validation, and dynamic content updates.

The following script will output "Hello World!" to the browser:


  document.write("Hello World!");

 Try It! 

RemarkTip: To learn more about Javascript tutorial, please check JavaScript tutorial !

HTML <noscript> Tag

The <noscript> tag provides alternative content when scripts cannot be used, such as when scripts are disabled in the browser, or when the browser does not support client-side scripting.

The <noscript> element can contain all the elements that can be found in the body element of a normal HTML page.

The content in the <noscript> element will only be displayed when the browser does not support scripting or when scripting is disabled:


  document.write("Hello World!")
  Sorry, your browser does not support JavaScript !

Try It! 

JavaScript Experiences (JavaScript Tutorial)

JavaScript example code:

JavaScript can be output directly in HTML:

document.write("<p>This is a paragraph.</p>");

Try It! 

JavaScript event response:

<button type="button" onclick="myFunction()">Click me!</button>

Try It! 

JavaScript handles HTML style:


Try It! 

HTML Script Tags

<script>Client script defined
<noscript>Defines text that does not support script browser output