检查存在于变量中的函数名是否存在 [英] check if function name which is stored in a variable exist

查看:76
本文介绍了检查存在于变量中的函数名是否存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如在此代码中:

for example in this code:

展开 | 选择 | Wrap | 行号

推荐答案

嗨......


欢迎来到TSDN ...


你为什么要使用eval? ...如果你不需要它...我想是这样的......你可以做类似以下的事情:

hi ...

welcome to TSDN ...

why do you use eval? ... in case you don''t need it ... and i think so ... you may do something like the following:

展开 | 选择 | Wrap | 行号


Heya,andho。欢迎来到TSDN!


查看这篇文章
Heya, andho. Welcome to TSDN!

Have a look at this article.


感谢您的欢迎和快速回复。检查那篇文章。但这是我真正的问题。

我有这个HTML:

[HTML]< input type =" text"命名= QUOT;单" ID = QUOT;单" onkeydown =" validate(event,''number'');" /> [/ HTML]

在onkeydown事件中,我调用validate函数,它有两个参数。一个是事件,另一个是要执行的验证类型,在本例中为数字。它可能是varchar或date,具体取决于用户想要如何使用它。

现在我需要检查''number''是否为函数然后调用它:
thanks for the welcome and quick replies. checked that article. but heres my real problem.
i have this HTML:
[HTML]<input type="text" name="single" id="single" onkeydown="validate(event, ''number'');" />[/HTML]
On the onkeydown event i call validate function which has two parameters. One is the event and the other is the type of validation to execute, in this case ''number''. It could be varchar or date depending on the how the user wants to use it.
now i need to check if ''number'' is a function and then call it:
展开 | 选择 | Wrap | 行号


这篇关于检查存在于变量中的函数名是否存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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