[Javascript] Function declaration

Matt Barton javascript at mattbarton.org
Tue Jan 20 06:25:01 CST 2004


Hi,

I've never seen that used before in Javascript, but have done in PHP (and I
would expect the same syntax would be used in similar languages), but only
for calling a function, never for declaring a function.

If I had to hazard a guess I'd say that the example you've supplied was
attemping to define the oncontextmenu function of the TreeView1 object.

I suppose it would be similar to having:

<div id="TreeView1"> Yada, yada, yada </div>
<script language="javascript">
function customContextMenu () {
        // do some stuff here
}
TreeView1.oncontextmenu = customContextMenu;
</script>

I've no idea if that is actually what the code you've supplied is doing, and
all of the above is untested - I'm just thinking on my feet.

HTH

Matt

----- Original Message ----- 
From: "Paul Cowan" <dagda1 at hotmail.com>
To: <javascript at LaTech.edu>
Sent: Tuesday, January 20, 2004 12:02 PM
Subject: [Javascript] Function declaration


> Hi all,
>
> Could anyone explain this function to me:
>
>
> function TreeView1::oncontextmenu(){
>     //implementation
> }
>
> It is the TreeView1:: before the function name that is something that I
have
> never seen before.
>
> Thanks
>
> Paul
>
> _________________________________________________________________
> Express yourself with cool emoticons - download MSN Messenger today!
> http://www.msn.co.uk/messenger
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
> --
> This email has been verified as Virus free
> Virus Protection and more available at http://www.plus.net




More information about the Javascript mailing list