访问功能参数 [英] Accessing parameters of a function
本文介绍了访问功能参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用HTML文件中<script>
块中的参数调用函数.该函数在外部JS文件中定义.该函数如何访问和操纵传递给它的参数?
I am calling a function with parameters from a <script>
block in an HTML file. The function is defined in an external JS file. How can the function access and manipulate the parameters that were passed into it?
html
<script>
myfunction({
effect: 'fade',
duration: '2000'
});
</script>
js文件
var myfunction = (function() {
/* How to get effect and duration */
})
推荐答案
如何获取类的参数
var varFunction = new myFunction('.classname', {
effect: 'fade',
duration: 2000
});
这篇关于访问功能参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文