Join TalkersCode Now !

Get Latest Tutorials And Links On Web Development
And Get Existing Offers Via Email

HTML Javascript

HTML Javascript


HTML Javascript is used to add interactivity on the webpage like alertbox or show hide the div or element.The script can be written using Javascript or VBScript.


Syntax:<script>Anything you define here</script>.script tag is always placed inside head tag.


  • External Javascript:Define script rules in a separate .js file and then include that file in your HTML document using HTML <script> tag.
  • Internal Javascript:Define script in the <head> tag inside <script> tag.


External Javascript

demo.js

function sample()
{
alert('This is the example of External Javascript');
}

scriptdemo.html

<! DOCTYPE html>
<html>
<head>
<srcipt src="demo.js" type="text/javascript"/></script>
</head>
<body>
<input type="button" onclick="sample();" value="Click">
</body>
</html>

Result of the above Example




Internal Javascript

<! DOCTYPE html>
<html>
<head>
<srcipt type="text/javascript">
function sample()
{
alert('This is the example of Internal Javascript');
}
</script>
</head>
<body>
<input type="button" onclick="sample();" value="Click">
</body>
</html>

Result of the above Example



You will learn complete Javascript in Javascript Tutorials


PreviousNext

Join Us With Our 21000+ Subscribers And Get Our Latest Tutorials Update Via Email

Are You Starting A New Blog
Do You Want Best Web Hosting?

Try World's Best Web Hosting Provider BlueHost
At Just $3.95/mo

Hurry Up! Limited Time Offer

Yes, I Want To Check Out BlueHost

Check The World's Best SEO And All-In-One Marketing Toolkit
For Digital Marketing Professionals SEMRUSH

Check Out SEMRUSH