Sunday, January 13, 2019

External Javascripts

External Javascripts :         

If the functionality to be defined is used in various HTML documents then it's better to keep that functionality in a separate Javascript file and then include that file in your HTML documents. A Javascript file will have extension as .js and it will be included in HTML files using script tag.

EXAMPLE:

<html>

<head>

<title>External Script</title>

<script src="/html/External.js" 
type="text/javascript"/>

</script>

</head>

<body>
<h2>Example for External Script</h2>

<input type="button" 
onclick="External();
" value="Click here"  />

</body>

</html>

OUTPUT:-
sk.


No comments:

Post a Comment

Internal Javascripts

Internal Javascripts :    The script code can be written directly into the HTML document. script code is placed in header of the docume...