Hosting Solutions
mobile_logo Table of Contents


The <script> element is used to add scripting to a document.

Code Example

<script> document.write('<h2>Welcome to the Show!</h2>'); </script> open in code editor

External scripts can be included into the document using the src attribute. Externalizing scripts helps keep your document cleaner and allows you to reuse that script in other document making it a templated script of sorts, I call mine modules.

<script src="scripts/external_script.js"></script>


globals - the global attributes common to all elements possible values: see global attribute list src - specify the path or url to an external script possible values: "path/to/script" type - specify the resource type possible values: "valid MIME type" async - specify that the script runs asynchronously possible values: value not required defer - attribute description possible values: value not required crossorigin - specify a crossorigin request security setting possible values: "anonymous", "use-credentials" charset - specify the character encoding of an external script possible values:

MIME type value examples for the "type" attribute:

"text/javascript" "text/x-javascript" "text/jscript" "text/livescript" "text/tcl" "text/ecmascript" "text/x-ecmascript" "application/ecmascript" "application/javascript" "application/x-ecmascript" "application/x-javascript"

Official Documentation



aabbraddressareaasidearticleaudiobbasebdobdiblockquotebodybrbuttoncanvascaptioncitecodecolcolgroupdatadatalistdddeldetailsdfndialogdivdldtemembedfieldsetfigcaptionfigurefooterformh1 h2 h3 h4 h5 h6headheaderhrhtmliiframeimginputinskbdkeygenlabellegendlilinkmainmapmarkmetameternavnoscriptobjectoloptgroupoptionoutputpparampreprogressqrb rp rt rtc rubyssampscriptsectionselectsmallsourcespanstrongstylesub supsummarytabletbodytdtemplatetextareatfootththeadtimetitletrtrackuulvarvideowbr