You are here: irt.org | FAQ | JavaScript | Bugs | Q1248 [ previous next ]
Affects:
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.
<html>
<head>
<script language="VBScript"><!-- //
Sub Test()
Rem Nothing
End Sub
// --></script>
<script language="JavaScript"><!-- //
function myFunction() {
alert('Ok');
return true;
}
// --></script>
</head>
<body>
<script language="JavaScript"><!-- //
myText = '<a href="javascript:;" language="JavaScript" onclick="myFunction();">Hello</a>';
document.writeln(myText);
//--></script>
</body>
</html>