读书人

.net中怎么调用javascript函数

发布时间: 2012-05-01 12:48:58 作者: rapoo

.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.html
[解决办法]

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的问题

读书人网 >asp.net

热点推荐