在asp.net中调用的javascript函数 [英] javascript function calling in asp.net

查看:74
本文介绍了在asp.net中调用的javascript函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,

我在javascript中创建了如下函数

Hi friends,

I created the function in javascript like the below

function abc()
{
    // Something.
}


是否可以调用abc(10,10)或abc(20)之类的函数?


can i call that function like abc(10,10) or abc(20) is it possible?

推荐答案

可以调用abc(10)之类的函数吗? ,10)或abc(20)是否可以?
是的,您可以-可以.

不会出现任何错误.最接近的JavaScript方法将被调用.因此,在您的示例中,对于abc(1)或abc(1,2)-都会引发abc()-只是您将无法使用传递/调用的参数作为方法被调用并不需要那么多参数.

我已经看到它可以正常工作.
can i call that function like abc(10,10) or abc(20) is it possible?
Yes, you can - it''s possible.

No error will be raised. Closest JavaScript method will be called. Thus, in your sample, for both abc(1) or abc(1,2) - abc() will be raised - it''s just that you won''t be able to use the passed/called parameters as the method invoked does not take that many parameters.

I have seen it working.


执行来自ASP.NET代码隐藏的JavaScript函数 [ ^ ]
http://forums.asp.net/t/1117189.aspx/1 [ ^ ]
Execute JavaScript function from ASP.NET codebehind[^]
http://forums.asp.net/t/1117189.aspx/1[^]



当您将参数值提供给函数时,则应该有接受这些否的方法.自变量/参数为

as you are giving parameter values to the function then you should have method accepting these no. of argument/parameters as
function abc(ist, second)
{
   alert(ist);
   alert(second);
}



然后像这样调用此方法:



then call this method like:

<input type="button" id="test" value="Test" onclick="abc('My name', 'address');" />


这篇关于在asp.net中调用的javascript函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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