29/09/2014

Inserting Javascript and Vbscript in HTML

Javascript and Vbscript are often used in a HTML page code to give more liveliness to the page, or just for one of the many applications of these scripts. Using these scripts you can create dynamic animations of some photos, an animated menu with amazing effects and so on. Also, one of the most important applications is that of validating a form before sending it. This will make the user spend considerably less time in the case the user has wrongly completed the fields, and a reload of the page being needed. In this part we will only talk about the method of inserting the script into HTML
Note: Most of the time it is much easier to just download from someone else than to write these scripts. In fact, that is just possible only if the author has given his/her agreement.
Inserting Javascript in HTML
Inserting a javascript code is done very easily using the script tag. Here is an example:
<script type="text/javascript">
<!--Here will be the the javascript code-->
</script>

For the javascript codes the 'text/javascript' value will be given to the type attribute.
Inserting Vbscript in HTML
Inserting a vbscript code is done in the same way as the javascript code is done, only that you replace the 'text/javascript' with 'text/vbscript' Here is the example:
<script type="text/vbscript">
<!--script
Here will be the the javascript code-->
</script>

It is always recommended to insert a comment along with the javascript and vbscript codes. That will warn the browsers that do not support that kind of script, or browsers that have javascript and vbscript disabled.