当前位置: 代码迷 >> ASP.NET >> .net中怎么调用javascript函数
  详细解决方案

.net中怎么调用javascript函数

热度:3365   发布时间:2013-02-25 00:00:00.0
.net中如何调用javascript函数
<TD onclick=restore();c1();setBar() height=20 vAlign=bottom width="15%" align=center>
<DIV style="CURSOR: hand" id=td1 class=lc></DIV></TD>
在html中是正常的,在asp.net中错误。
restore();c1();setBar() 是javascript代码,该段代码是前台页面。
在asp.net中如何实现呢?

------解决方案--------------------------------------------------------
http://www.cnblogs.com/zyx_blog/articles/1993473
------解决方案--------------------------------------------------------
C# code
        string script = "<script>setTimeout(function(){ alert('" + strMsg + "');},1000)</script>";        this.Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), script);
------解决方案--------------------------------------------------------
调用前台js方法
Page.ClientScript.RegisterStartupScript(GetType(), key, "<script>setBar()</script>");


------解决方案--------------------------------------------------------
string script = @"alert('" + result + "')";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(),Guid.NewGuid().ToString(), script,true);
------解决方案--------------------------------------------------------
C# code
[Quote=引用:]C# code        string script = "<script>setTimeout(function(){ alert('" + strMsg + "');},1000)</script>";        this.Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToStri……[/Quote]
------解决方案--------------------------------------------------------
VB.NET code
ScriptManager.RegisterStartupScript(Me, Me.GetType, "", "restore();c1();setBar();", True)
------解决方案--------------------------------------------------------
onclick="restore();c1();setBar()"
------解决方案--------------------------------------------------------
原来还可以这么用,见识了.
探讨
onclick="restore();c1();setBar()"

------解决方案--------------------------------------------------------
C# code
<script language="javascript" type="text/javascript">function GetIT(){    alert("haha");}function GetIT2(){    alert("haha2");}function GetIT3(){    alert("haha3");}</script>
------解决方案--------------------------------------------------------
是不是TD的问题
  相关解决方案