1<html> 2<head> 3<script type="text/vbscript"> 4<!-- 5Dim counter 6 7counter = 1 8 9Sub ok(b,m) 10 Call external.ok(b,m) 11End Sub 12--> 13</script> 14<script> 15' Verifies that we're in VBScript although there is no type specified 16If true then counter = counter+1 17function inccounter(x) 18 counter = counter+x 19end function 20</script> 21<script type="text/javascript"> 22// We're in javascript 23try { 24 counter++; 25 incCounter(2); 26}catch(e) { 27 ok(false, "got an exception " + e.message); 28} 29</script> 30<script> 31' And back to VBScript 32If true then counter = counter+1 33 34Sub runTest() 35 Call ok(counter = 6, "counter = " & counter) 36 Call ok(isNull(document.onkeyup), "document.onkeyup is not null") 37 Call ok(document.formname.tagName = "FORM", "document.form.tagName = " & document.formname.tagName) 38 Call ok(formname.tagName = "FORM", "form.tagName = " & formname.tagName) 39 Call external.reportSuccess() 40End Sub 41</script> 42<script type="text/javascript"> 43// We're in javascript 44</script> 45<body onload="If true then runTest()"> 46<form name="formname"></form> 47</body> 48</html> 49