Javascript (JS) was introduced a while back (sometime around the mid '90s) to make
HTML
dynamic. Originaly, it was only supported by Netscape, but after a while, Microsoft
introduced a scaled-back version called JScript. Eventually, Microsoft introduced its own
scripting langauge called VBScript. VBScript is a scaled-back (drasticly) version of Visual Basic and is only supported by Internet Explorer...
To insert any script into HTML, use the <script> tag. Put the script tag inside the <head> tag.
Here's the syntax:
<html> <head> <script language="javascript or vbscript"> <!-- You're code goes here '//> </script> </head> <body> This is a script page!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! </body> </html>
Diolauge boxes are supported by both JS and VBS. VBS gives you more control over the outcome of the box, however.
Here's some samples:
Javascript
<script language="javascript">
<!--
alert ("Hello, World!)
//-->
</script>
<script language="vbscript"> < MsgBox "Hello, World!", 64, "Hi!" '--> </script>
To write text to the screen, you can use JS or VBS. This useful for adding more text when a button is pressed.
Javascript
<html>
<head>
<script language="javascript">
<!--
function updatetext() {
document.write ("Howdy!")
}
//-->
</head>
<body>
<input type="button" value="Say Hi!" id="hi" onClick="javascript:updatetext()">
</body>
</html>
<html> <head> <script language="vbscript"> <!-- Sub updatetext() Print "Howdy!" End Sub '--> </head> <body> <input type="button" value="Say Hi!" id="hi" onClick="vbscript:updatetext"> </body> </html>
Javascript was based on Java, which in turn was based on C++.
VBScript was based on Visual Basic.