从asp.net C#页面外部JavaScript文件 [英] external javascript file from asp.net C# page

查看:155
本文介绍了从asp.net C#页面外部JavaScript文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写在外部JavaScript文件中的一些JavaScript函数。
我已经包含在我的asp.net页面head部分文件。
但我不是能够理解我要如何隐藏文件code调用的函数。
例如,我想打电话给一个文本框的安其preSS事件一定的功能tacount。我可以怎么做?

i have some javascript functions written in an external javascript file. and i have included the file in my asp.net page head section. however i m not able to understand how do i call the functions from the code behind file. e.g, i want to call a certain function 'tacount' on onkeypress event of a textbox. how can i possible do that?

推荐答案

您不能调用客户端从服务器端 code面功能。

You can't call client side functions from server side code.

您的可能的发射JavaScript来从服务器端code调用这些功能,但是这可能会变得非常混乱。

You could emit javascript to call these functions from your server side code, but this can get very messy.

而不是附加的JavaScript函数的服务器端的事件,这样做在客户端。

Instead of attaching javascript functions to server side events, do so on the client side.

使用一个库,如jQuery的事件附加到文本框的客户端。

Use a library such as jQuery to attach the event to your textbox on the client side.

这篇关于从asp.net C#页面外部JavaScript文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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