Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap

Q1248 Why do I get a strange error on a page with both javascript and vbscript?

You are here: irt.org | FAQ | JavaScript | Bugs | Q1248 [ previous next ]

Affects: Internet Explorer 4.x 4.x

Errors such as "end of statement expected" and "cannot use parens"

They appear if you have a VBScript in the head BEFORE a JavaScript and then call the JavaScript function from a handler in the page. It is due to Internet Explorer setting the default scripting language to VBScript and then it gets JavaScript in a handler instead.

Solution: Add LANGUAGE="JavaScript" to the tag in question.


<script language="VBScript"><!-- //
Sub Test()
   Rem Nothing
End Sub
// --></script>

<script language="JavaScript"><!-- //
function myFunction() {
   return true;
// --></script>



<script language="JavaScript"><!-- //
myText = '<a href="javascript:;" language="JavaScript" onclick="myFunction();">Hello</a>';


©2018 Martin Webb