jQuery.globalEval()方法
jQuery 教程
· 2019-03-29 08:18:31
实例
在全局上下文中执行脚本
var name = "全局变量";
$(function () {
function test(){
var name = "局部变量";
alert(name); // 局部变量
eval( "alert(name);" ); // 局部变量
$.globalEval( "alert(name);" ); // 全局变量
}
test();
})
定义和用法
jQuery.globalEval() 函数用于全局性地执行一段JavaScript代码。
提示:该函数的作用与常规的JavaScript eval()函数相似。不同的是,jQuery.globalEval()执行代码的作用域为全局作用域。
语法
$.globalEval( code )
| 参数 | 描述 |
|---|---|
| code | String类型 指定的需要运行的JavaScript代码字符串。 |
点击查看所有 jQuery 教程 文章: https://codercto.com/courses/l/35.html
The Elements of Statistical Learning
Trevor Hastie、Robert Tibshirani、Jerome Friedman / Springer / 2009-10-1 / GBP 62.99
During the past decade there has been an explosion in computation and information technology. With it have come vast amounts of data in a variety of fields such as medicine, biology, finance, and mark......一起来看看 《The Elements of Statistical Learning》 这本书的介绍吧!