N
news.rz.uni-karlsruhe.de
I wrote an event handler with
Sys.UI.DomEvent.addHandler($get("MyButton"),"click",myfunc);
function myfunc(event)
{
alert("Hi!");
}
1.) If I write this code as a javascript block after the page under the
closing </html> tag everything works fine.
2.) If I write this code as a javascript block between the <head> tags I get
an null pointer error from $get("MyButton").
3.) I get the same error if I use the ScriptManager.Scripts.Add(Reference),
obviously because the button "MyButton" doesn't exist yet.
So how can I add my event handler programmatically to achive the same
effect as in 1.)?
Regards
R4DIUM
Sys.UI.DomEvent.addHandler($get("MyButton"),"click",myfunc);
function myfunc(event)
{
alert("Hi!");
}
1.) If I write this code as a javascript block after the page under the
closing </html> tag everything works fine.
2.) If I write this code as a javascript block between the <head> tags I get
an null pointer error from $get("MyButton").
3.) I get the same error if I use the ScriptManager.Scripts.Add(Reference),
obviously because the button "MyButton" doesn't exist yet.
So how can I add my event handler programmatically to achive the same
effect as in 1.)?
Regards
R4DIUM