HTML Scripts (HTML Tutorial part 27)

১১/১৮/২০১১ ০৮:৪৭:০০ AM | | 0 comments »

There are two very popular scripts that are commonly used in HTML to make web pages come alive. HTML javascript and HTML vbscript are very useful scripting languages to know, if you have the time.

With HTML scripts you can create dynamic web pages, make image rollovers for really cool menu effects, or even validate your HTML form's data before you let the user submit. However, javascript and vbscript are very complicated compared to HTML. It may be simpler just to download someone elses scripting code and use it on your web page (if they have given you permission to do so, of course!).

HTML Javascript Code

If you want to insert javascript code into your HTML you are going to use the script tag. If you would like to know more about javascript, check out our Javascript Tutorial. Below is the correct code to insert embedded javascript code onto your site.

HTML Code:

<script type="text/javascript">
<!--script
***Some javascript code should go here***
-->
</script>
For javascript you set the type attribute equal to "text/javascript", which is similar to the process of specifying CSS. We also include a comment around the javascript code. This will prevent browsers that do not support javascript or have had javascript disabled from displaying the javascript code in the web browser.

HTML Vbscript How To

To insert vbscript code onto your website you must once again make use of the script tag. Below is the correct code to insert vbscript code onto your site.

HTML Code:

<script type="text/vbscript">
<!--script
***The vbscript code should go in this spot***
-->
</script>
For vbscript you set the type attribute equal to "text/vbscript", which is similar to specifying CSS. We also include a comment around the vbscript code. This will prevent browsers that do not support vbscript or have had vbscript disabled from displaying the vbscript code in the web browser.