I want to dynamically check on the client side to see if a control has an onchange event handler
and then if so, to call it. Does this sort of functionality exist within javascript ?? It's sort of
similar to the SQL's EXECUTE( 'somestring' ) functionality
Thanks
LES
you can dynamically detect if a control has a handler, but you won't know
what parametrs it expects
<input id=text1 type=text onchange="doChange(this,'myData')">
<input id=text2 type=text >
<script>
if (document.getElementById('text1').onchange != null)
document.getElementById('text1').onchange();
</script>
-- bruce (sqlwork.com)
> I want to dynamically check on the client side to see if a control has an onchange event handler
> and then if so, to call it. Does this sort of functionality exist within javascript ?? It's sort of
[quoted text clipped - 3 lines]
>
> LES
lester - 01 Mar 2004 22:46 GMT
Thanks !
I can get the string "doChange(this,'myData')" from the arrtibutes collection of text1, so that will get me th
string arguments and/or literals, but is there any way to deal with variables like the name of an array ?
LE
----- bruce barker wrote: ----
you can dynamically detect if a control has a handler, but you won't kno
what parametrs it expect
<input id=text1 type=text onchange="doChange(this,'myData')"><input id=text2 type=text ><script
if (document.getElementById('text1').onchange != null
document.getElementById('text1').onchange()
</script
-- bruce (sqlwork.com
"lester" <anonymous@discussions.microsoft.com> wrote in messag
news:E11B2464-84EC-4F1C-882D-E8DC1AD413D5@microsoft.com..
>> I want to dynamically check on the client side to see if a control has a
onchange event handle
> and then if so, to call it. Does this sort of functionality exist withi
javascript ?? It's sort o
> similar to the SQL's EXECUTE( 'somestring' ) functionality
>> Thanks
>> LE
lester - 01 Mar 2004 23:01 GMT
Actually, since this is all interpreted, something is taking the string "doChange(this,'myData')" and
parsing and executing it. Can I get access to that functionality ?
LES
----- bruce barker wrote: ----
you can dynamically detect if a control has a handler, but you won't kno
what parametrs it expect
<input id=text1 type=text onchange="doChange(this,'myData')"><input id=text2 type=text ><script
if (document.getElementById('text1').onchange != null
document.getElementById('text1').onchange()
</script
-- bruce (sqlwork.com
"lester" <anonymous@discussions.microsoft.com> wrote in messag
news:E11B2464-84EC-4F1C-882D-E8DC1AD413D5@microsoft.com..
>> I want to dynamically check on the client side to see if a control has a
onchange event handle
> and then if so, to call it. Does this sort of functionality exist withi
javascript ?? It's sort o
> similar to the SQL's EXECUTE( 'somestring' ) functionality
>> Thanks
>> LE
bruce barker - 02 Mar 2004 01:32 GMT
the browser builds an anonymous function for the onchange string
<input id=text1 type=text onchange="doChange(this,'myData')">
is equivalent of:
object.onchange = new Function("doChange(this,'myData')");
to dynamically execute javascript, just use the eval.
a = eval('1 + 2');
or
<input id=text1 type=text onchange="doChange(this,'myData')">
<script>
eval(document.getElementById('text1').attributes['onchange'].value);
//
</script>
but the problem will be that the parameter "this", will not be the control,
but rather the window object (owner of anonymous scripts).
-- bruce (sqlwork.com)
> Actually, since this is all interpreted, something is taking the string "doChange(this,'myData')" and
> parsing and executing it. Can I get access to that functionality ??
[quoted text clipped - 21 lines]
> >> Thanks,
> >> LES