Latest web development tutorials

HTML script

JavaScript allows HTML pages with more dynamic and interactive.


Online examples

Insert a script
How to insert scripts into HTML documents.

Use the <noscript> tag
How to deal with do not support scripting or scripting is disabled browser.

HTML <script> tag

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

<Script> element can contain script statements, but also point to an external script file through the src attribute.

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

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


<Script> document write ( "Hello World!");. </ Script>

try it"

RemarkTip: Learn more about Javascript tutorials, see the JavaScript tutorial !

HTML <noscript> tag

<Noscript> tag to provide alternate content when a script can not be used, for example, when the browser disables scripts, or browser does not support client script.

All elements can be found in the body element <noscript> element can contain ordinary HTML page.

Only when the browser does not support scripting or scripting is disabled, appears <noscript> element content:


<Script> document. Write ( " Hello World!") </ Script> <noscript> Sorry, your browser does not support JavaScript! </ Noscript>

try it"

JavaScript experience (from the site javascript tutorial)

JavaScript code examples:

JavaScript directly in the HTML output:

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

try it"

JavaScript event response:

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

try it"

JavaScript processing HTML style:

. document getElementById ( "demo") style color = "# ff0000"..;

try it"

HTML script tag

label description
<script> It defines a client-side script
<noscript> Defined browser does not support script output text