html select execute javascript onload

Posted by portoalet on Stack Overflow See other posts from Stack Overflow or by portoalet
Published on 2010-05-06T02:38:51Z Indexed on 2010/05/06 2:48 UTC
Read the original article Hit count: 257

Filed under:
|
|
|

I am using HTML select onchange event to fire another javascript function func1.

This html select is written into a form element, which are dynamically generated when users click on a button.

The problem is how can I fire the javascript func1 when the dynamically generated form is first shown ? I am thinking of something along the line of on_first_show event for form ?

Here is the snippet. I couldnt get the alert('don') to work either (the one just after div)

var sPopupContents = "<div ><script type='text/javascript'>alert('don');</script> </div>"; // this javascript is not executed ? I cant get the alert.
sPopupContents += "<form name='theform' >";
sPopupContents += "<select name='theselect' onchange='alert(2);";
sPopupContents += "func1()>'";
sPopupContents += "<option value='0' selected='selected'>Value1</option><option value='1'>Value2</option><br/>";
sPopupContents += "</form>";

© Stack Overflow or respective owner

Related posts about html

Related posts about select