当前位置:编程学习 > C#/ASP.NET >>

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();");
} --------------------编程问答--------------------
引用 3 楼 msdnxgh 的回复:
执完事件后, Response.Write();JAVASCRITPT代码,试试。。

++ --------------------编程问答-------------------- 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); --------------------编程问答--------------------
引用 9 楼 wuyq11 的回复:
TextBox1.Attribute.add("onkeypress","A('Button1')");
function A(button)
  {
  if(event.keyCode == 13)
  {
  event.keyCode = 9;
  event.returnValue = false;
  document.documentById(button).click……

这个应该可以
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,