double colons in Javascript

F

fpolowood

I found some javascript code that I thought was extremely interesting,
it contained double colons in the name of the functions. In order to
test if this was accessible to us humans, I wrote this small sample:

<html>
<body>
<input id=mine></input>
</body>
<script>
function mine::OnClick()
{
alert( 'got it' );
}
</script>
</html>

AND... believe it or not... IT WORKS!!!! if you click on the text box
you'll get the alert. SO, the questions that come to mind are:

1) Is this a IE only thing? (I have only tried it on IE, don't have
anything else)
2) Is this an early implementation of JavaScript 2.0 (even though I
tested with IE 6.0 and 7.0, at least 6 predates any of the 2.0 drafts)
3) How can we make use of this technology? Where is the connection
made between the function and the control? (I debugged into the code
and inspected every aspect I could think of the control and there was
no evidence of where the hook was taking place -- i.e. mine.onclick
was null)

Any ideas?
 
K

kai

I found some javascript code that I thought was extremely interesting,
it contained double colons in the name of the functions. In order to
test if this was accessible to us humans, I wrote this small sample:

<html>
<body>
<input id=mine></input>
</body>
<script>
function mine::OnClick()
{
alert( 'got it' );}

</script>
</html>

AND... believe it or not... IT WORKS!!!! if you click on the text box
you'll get the alert. SO, the questions that come to mind are:

1) Is this a IE only thing? (I have only tried it on IE, don't have
anything else)
2) Is this an early implementation of JavaScript 2.0 (even though I
tested with IE 6.0 and 7.0, at least 6 predates any of the 2.0 drafts)
3) How can we make use of this technology? Where is the connection
made between the function and the control? (I debugged into the code
and inspected every aspect I could think of the control and there was
no evidence of where the hook was taking place -- i.e. mine.onclick
was null)

Any ideas?

Doesn't work in Firefox 2.0.5/3 and Safari 3 on Windows (running
fairly recently nightly webkit)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top