Jump to content

[HTML] JavaScript


RayoK
 Share

Recommended Posts

JavaScript and Vbscript are often used in a HTML page code to give more interactivity to the page, or just for one of the many applications of these scripts.

Using these scripts you can create interactiv animations for images, animated menus 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 the internet than to write these scripts. Of course, that is possible only if the author has given his/her agreement for personal and/or comercial use. There are also a variety for javascript libraries that are free to use.

Inserting JavaScript in HTML

Inserting a javascript code is done very easily using the script tag. Here is an example:

HTML<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:

HTML<script type="text/vbscript">

/* 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.

Edited by Cdorsu
Link to comment
Share on other sites

  • Cdorsu locked this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.