我有问题从代码behinde C#调用javascript函数 [英] i have a problem to call javascript functions from code behinde C#

查看:68
本文介绍了我有问题从代码behinde C#调用javascript函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此代码从后面的代码调用javasCript函数



im using this code to call javasCript function from code behind

ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'> myFunc()</script>", false);





当我再次使用此代码时,我的程序只调用第一个javasCript函数!

有什么问题?!



when i use this code again , my program just call the first javasCript function !
what is the problem ?!

推荐答案

试试以下版本:



try the below version:

Page.ClientScript.RegisterStartupScript(this.GetType(),"alert","myFunc();",true);







<script type="text/javascript">
function myFunc()
{
window.alert('hii');
}
</script>


这篇关于我有问题从代码behinde C#调用javascript函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆