Categories:
Partners

VBScript and browser compatibility

It's important to note that VBScript is supported only by Internet Explorer. Furthermore, like JavaScript, the language has evolved considerably since its inception, with differing versions. In general, you can incorporate both JavaScript and VBScript on your page without fear of one stepping over the other. This is so thanks to the optional language attribute each <script> tag supports, which you should remember to specify:

<script language="VBScript">
"
"
</script>

Illiterate browsers will simply ignore the above.

To complete this tutorial, lets take the final example from the previous page, and make it cross browser functional:

<script language="VBscript">
Sub entrance_onClick
returnvalue=MsgBox ("You are about to enter a DHTML intensive site. Proceed?",52,"Greetings!")
If returnvalue=6 Then
window.location="http://www.dynamicdrive.com"
Else
window.location="http://www.yahoo.com"
End If
End Sub

</script>

<script language="JavaScript">
function entrance2(){
if(navigator.appName!="Netscape")
return
if (confirm("You are about to enter a DHTML intensive site. Proceed?"))
window.location="http://www.dynamicdrive.com"
else
window.location="http://www.yahoo.com"
}
</script>

<form>
<input type="button" name="entrance" value="Click here" onClick="entrance2()">
</form>