can you "inline" event handlers for objects in 1 script like in VBScript?

Giganews Newsgroups
Subject: can you "inline" event handlers for objects in 1 script like in VBScript?
Posted by:  fdeck…@aol.com (Fred)
Date: 18 Jul 2003

This seems awkward, isn't there a better way to place event handlers
in the rest of the code with the logic for everything else like you
can with VBScript?

<script language="javascript"
  if (myvar == true " {
    do something
  }
  lots more code here...

</script>

<script for="myActiveX" event="Onclick()" language="javascript">
  code for this event
</script>

<script for="myTreeView" event="OnConnect()" language="javascript">
  code for this event
</script>
....

In other words, can I put it all between one <script></script> tag?

Thanks,

Fred

Replies