html select execute javascript onload
- by portoalet
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>";