开发者

Why an input button created dynamically through a literal tag doesn't work?

开发者 https://www.devze.com 2022-12-24 09:30 出处:网络
I have created button 2 below: <input id=\"Button1\" type=\"button\" value=\"Stop\" onclick=\"alert(\'hello world\');\"/>

I have created button 2 below:

<input id="Button1" type="button" value="Stop" 

    onclick="alert('hello world');"/> 

<input id="Button2" type="button" value="button" OnClik="alert('hello world');"/> 

using a litteral tag on page load like this:

protected void Page_Load(object sender, EventArgs e)
{

    Literal1.Text = "<input id=\"Button2\" type=\"button\" value=\"button\" OnClik=\"al开发者_如何学JAVAert('hello world');\"/>";

}

Incredibly when testing in browser, click on button 1 works, not click on button 2 whereas the codes are the same !

Am I missing something ?


You misspelled onclick for the second button

0

精彩评论

暂无评论...
验证码 换一张
取 消