日期:2014-05-17  浏览次数:20400 次

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