basic DOM event handling

"Michael Franklin" <[email protected]> Mon, 18 Apr 2005 12:10:00 +1200
Newsgroups gmane.comp.windows.devel.netwindows
Message-ID <74D0039691DD1A4DA59C4D13CA21CD990C7DFB@akl-exbe001.corp.peace.com>
This is a multi-part message in MIME format.

--===============0162542535==
content-class: urn:content-classes:message
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C543AA.F62163E3"

This is a multi-part message in MIME format.

------_=_NextPart_001_01C543AA.F62163E3
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi,

=20

I am trying to get a handle on the netWindows event model, which looks
very good.  So I tried to modify netWindows 0.3.0
/docs/widget_test_pages/multi_line_eval.html to pop up an alert for the
textarea onkeyup event, as shown in the code below.  But it doesn't
work: mytest() is never called.  Can anyone please explain what I am
doing wrong?

=20

<script language=3D"JavaScript">

                //widget includes

=20
__scripts__.require(__config__.widgetPath+"text_expander_widget.js");

=20
__scripts__.require(__config__.widgetPath+"button_widget.js");

=20

        function mytest() {

            alert( "mytest()" );

        }

       =20

function envInit(){

            create_console('<<debugging console initialized>>', 0, 0,
'right', 'top', 400, 300, 100);

=20

            var ta =3D document.getElementById( "eval_code" );

          if( ta !=3D null ) {

                alert( "setting handler" );

                __sig__.connect( ta, onkeyup, null, mytest );

          } else {

                alert( "can't find ta" );

          }

}

        __sig__.connect(__env__, __env__.onLoad, null, envInit);

=20

</script>

=20

Thanks,

=20

Michael

=20


------_=_NextPart_001_01C543AA.F62163E3
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html>

<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered)">
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:"Microsoft Sans Serif";
	panose-1:2 11 6 4 2 2 2 2 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
p
	{margin-right:0cm;
	margin-left:0cm;
	font-size:12.0pt;
	font-family:"Times New Roman";}
span.EmailStyle17
	{font-family:"Microsoft Sans Serif";
	color:windowtext;
	font-weight:normal;
	font-style:normal;
	text-decoration:none none;}
@page Section1
	{size:612.0pt 792.0pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif"'>Hi,</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif"'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans Serif"'>I am =
trying to get
a handle on the netWindows event model, which looks very good.&nbsp; So =
I tried
to modify netWindows 0.3.0 /docs/widget_test_pages/multi_line_eval.html =
to pop
up an alert for the textarea onkeyup event, as shown in the code =
below.&nbsp;
But it doesn&#8217;t work: mytest() is never called.&nbsp; Can anyone =
please
explain what I am doing wrong?</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif"'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans Serif"'>&lt;script
language=3D&quot;JavaScript&quot;&gt;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; //widget
includes</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; =
__scripts__.require(__config__.widgetPath+&quot;text_expander_widget.js&q=
uot;);</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; =
__scripts__.require(__config__.widgetPath+&quot;button_widget.js&quot;);<=
/span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif"'>&nbsp;</span></font></p>

<p class=3DMsoNormal><b><font size=3D2 face=3D"Microsoft Sans =
Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif";font-weight:bold'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
function mytest() {</span></font></b></p>

<p class=3DMsoNormal><b><font size=3D2 face=3D"Microsoft Sans =
Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif";font-weight:bold'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;
alert( &quot;mytest()&quot; );</span></font></b></p>

<p class=3DMsoNormal><b><font size=3D2 face=3D"Microsoft Sans =
Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif";font-weight:bold'>&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;}</span></font></b></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans Serif"'>function =
envInit(){</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;
create_console('&lt;&lt;debugging console initialized&gt;&gt;', 0, 0, =
'right',
'top', 400, 300, 100);</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif"'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;
<b><span style=3D'font-weight:bold'>var ta =3D document.getElementById(
&quot;eval_code&quot; );</span></b></span></font></p>

<p class=3DMsoNormal><b><font size=3D2 face=3D"Microsoft Sans =
Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif";font-weight:bold'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;
if( ta !=3D null ) {</span></font></b></p>

<p class=3DMsoNormal><b><font size=3D2 face=3D"Microsoft Sans =
Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif";font-weight:bold'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
alert( &quot;setting handler&quot; );</span></font></b></p>

<p class=3DMsoNormal><b><font size=3D2 face=3D"Microsoft Sans =
Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif";font-weight:bold'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
__sig__.connect( ta, onkeyup, null, mytest );</span></font></b></p>

<p class=3DMsoNormal><b><font size=3D2 face=3D"Microsoft Sans =
Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif";font-weight:bold'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;
} else {</span></font></b></p>

<p class=3DMsoNormal><b><font size=3D2 face=3D"Microsoft Sans =
Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif";font-weight:bold'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
alert( &quot;can't find ta&quot; );</span></font></b></p>

<p class=3DMsoNormal><b><font size=3D2 face=3D"Microsoft Sans =
Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif";font-weight:bold'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=

&nbsp;}</span></font></b></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif"'>}</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
__sig__.connect(__env__, __env__.onLoad, null, =
envInit);</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif"'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif"'>&lt;/script&gt;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif"'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif"'>Thanks,</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif"'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif"'>Michael</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Microsoft Sans Serif"><span
style=3D'font-size:10.0pt;font-family:"Microsoft Sans =
Serif"'>&nbsp;</span></font></p>

</div>

</body>

</html>

------_=_NextPart_001_01C543AA.F62163E3--


--===============0162542535==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
The netWindows developers list: [email protected]
http://netwindows.org/mailman/listinfo/devel_netwindows.org

--===============0162542535==--