Previous | Home | Next |
Script language work with support of other language. (not a complete language depends on other language). This tag is used for client-side script as like a JavaScript and main useful uses such as JavaScript are image manipulation, form validation, and dynamic changes of html document.
It also provided to place a script within your HTML document.
Have you ever joined a new affiliate program or created a new publication that you wanted to add to your existing navigational set up, but dreaded having to manually add the links to every page on your site?
Syntax use in Script
<script> //code to be executed </script>
HTML script tag are two type of usage like as
- Link script file
- Embed script code
The script tag can be used to link external script file by src attribute. It must be used within the <head> tag only.
Example
<html>
<head>
<script type="text/javascript" src="message.js"></script>
</head>
<body>
<p>Welcome to JavaScript</p>
<form>
<input type="button" value="click" onclick="msg()"/>
</form>
</body>
</html>
Output :
It is used within <body> or <head< tag to embed the scripting code.
Example
<html> <body> <script type="text/javascript"> document.write("This is provides a JavaScript is a simple language for r4r.co.in learners"); </script> </body> </html>
Output :
Example for using HTML head tag in Embed script code
<html> <head> <script type="text/javascript"> function msg(){ alert("Hello r4r.co.in"); } </script> </head> <body> <p>Welcome to Javascript</p> <form> <input type="button" value="click" onclick="msg()"/> </form> </body> </html>
Output :
Previous | Home | Next |