EVENT事件怎么调用js
EVENT事件怎么调用js? --------------------编程问答-------------------- 什么意思? --------------------编程问答-------------------- 我想在protected override void FormCancelEvent(){//这里调用show()方法}<script language="javascript">
function show() {
if (confirm("Are you sure you wish to cancel?")) {
window.location = "../../Default.aspx";
}
}
</script>
我不知道怎么调用 --------------------编程问答-------------------- 执完事件后, Response.Write();JAVASCRITPT代码,试试。。 --------------------编程问答-------------------- Page.ClientScript.RegisterStartupScript(type, key, script); --------------------编程问答-------------------- 嗯,绑定JAVASCRIPT好点,这样不会在HMTL代码外面。。 --------------------编程问答-------------------- regester.clientscriptInclude("js");//JS文件,好象是form后/form前
regester.clientscriptResource("js");//编译的资源JS,好象是form后/form前
regester.startscipt("js");//........... --------------------编程问答-------------------- protected override void FormCancelEvent(){
Response.Write("show();");
} --------------------编程问答--------------------
++ --------------------编程问答-------------------- TextBox1.Attribute.add("onkeypress","A('Button1')");
function A(button)
{
if(event.keyCode == 13)
{
event.keyCode = 9;
event.returnValue = false;
document.documentById(button).click();
}
}
<asp:TextBox id="tbInput" runat="server" Width="240px"> </asp:TextBox>
<asp:Button id="btnOK" runat="server" BorderWidth="1px" Text="A"> </asp:Button>
TextBox1.Attributes.Add("onkeydown", "if(event.keyCode==13){document.all.btnOK.focus();document.all.btnOK.click();}");
--------------------编程问答-------------------- Page.ClientScript.RegisterStartupScript(this.GetType(), new Random().ToString(), "test()", true); --------------------编程问答--------------------
这个应该可以
补充:.NET技术 , ASP.NET