[thelist] Dumb Question (Javascript) but still causingdifficulties
James Aylard
evolt at pixelwright.com
Wed May 12 15:23:48 CDT 2004
> On Wed, May 12, 2004 at 09:59:03AM -0700, James Aylard wrote:
>> I disagree. For those who have written both JavaScript/JScript
>> and VBScript client-side for Internet Explorer, it is sometimes
>> necessary to prefix an inline script or function call with a
>> scripting language pseudo-protocol when that bit of script is in a
>> language other than the default scripting language of the page
>> (typically, the default scripting language for the page is
>> determined by the language of the first script block in the page; if
>> no script block is supplied, the page language defaults to JScript).
Emma Jane Hogbin wrote:
> Never in an event handler (the "on"s). Yes in other attributes
> though. For example:
> <a href="javascript:doSomething()">clicky button</a>
> but really you should use:
> <a onclick="doSomething(); return false" href="">clicky button</a>
I don't think you read my post carefully enough, as your answer has no
bearing on what I wrote. There is one case in which a script-language
protocol (e.g., javascript:) is appropriate, even within an event handler,
and that is where more than one client-side scripting language is used
within a page, and even then only under certain circumstances. For instance:
<html>
<head>
<title>Two Script Languages on a Single Page</title>
<script type="text/vbscript">
Dim strTest
strTest = "Hello, VBScript"
MsgBox(strTest)
</script>
</head>
<body>
<p onmouseover="javascript:strTest='Hello, Javascript';alert(strTest);"
>Pleased to meet you.</p>
</body>
</html>
James Aylard
More information about the thelist
mailing list