在calendar中添加了一个ImageButton控件
ImageButton newAgenda = new ImageButton();
newAgenda.Attributes.Add("onClick", "javascript:alert('Hello,world');");控件中添加上面的代码可以执行,但如果添加:
newAgenda.Attributes.Add("onClick", "javascript:location.href='test.aspx'");
就不能执行了?
ImageButton newAgenda = new ImageButton();
newAgenda.Attributes.Add("onClick", "javascript:alert('Hello,world');");控件中添加上面的代码可以执行,但如果添加:
newAgenda.Attributes.Add("onClick", "javascript:location.href='test.aspx'");
就不能执行了?
<asp:Image/>
</a>
newAgenda.Attributes.Add("onClick", "window.location.href('test.aspx');");
<input type="image" src="image/Edit.gif" onclick="javascript:window.location.href='test.aspx';" style="border-width:0px;" /><input type="image" src="image/Edit.gif" onclick="javascript:document.location.href='test.aspx';" style="border-width:0px;" /><input type="image" src="image/Edit.gif" onclick="javascript:window.navigate('test.aspx');" style="border-width:0px;" />
Button1.Attributes.Add("onClick", "javascript:location.href='test.aspx';");运行,按Button1,页面闪一下,但把生成的html另存一个文件,直接打开html文件,按Button1按钮,可以实现页面跳转!