如何报名(电话)的jQuery从asp.net用户控件从codebehind文件的功能? [英] How register (call) jQuery function from asp.net usercontrol from codebehind file?

查看:86
本文介绍了如何报名(电话)的jQuery从asp.net用户控件从codebehind文件的功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从asp.net用户控件从codebehind文件中注册(通话)jQuery函数?

How register (call) jQuery function from asp.net usercontrol from codebehind file?

推荐答案

您可以使用的 ClientScriptManager.RegisterStartupScript() ,例如:

You can use ClientScriptManager.RegisterStartupScript(), for example:

var script = "$(function() { $('#message').fadeIn(); });";
Page.ClientScript.RegisterStartupScript(GetType(), "keyHere", script, true);

本被呈现在页面:

<script type="text/javascript">
  $(function() { $('#message').fadeIn(); });
</script>

脚本只是任何JavaScript,没有什么特别的jQuery的,只是摆在那里无论你将手动把页面,因为这是它的结束。

The script is just any JavaScript, nothing special about jQuery, just put in there whatever you would manually put in the page, since that's how it ends up.

这篇关于如何报名(电话)的jQuery从asp.net用户控件从codebehind文件的功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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