求救啊!!JS为什么自动调用后台方法啊!
倔強 2011-10-17 03:23:27 事情是这样的
我写了一个后台方法Update()
public void Update()
{
Page.ClientScript.RegisterStartupScript(this.GetType, "update", "alert('测试')", true);
}
然后前台写了个JS代码
function UpdateJs() {
<% Update(); %>;
}
我是动态生成的button控件!
用的是lable的赋值
lblOk.Text =“<input type='button' onclick='UpdateJs()' value='确定' />”
当我运行这个页面的时候!JS就自动调用了Update()方法;
弹出了“测试'”2个字!!
我都没触发这个click事件!也没按这个button啊!!
他就直接运行了!!
求教啊!!