博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
js奇葩错误 字符串传递问题
阅读量:4553 次
发布时间:2019-06-08

本文共 610 字,大约阅读时间需要 2 分钟。

第一种方式

function hello(){
    var name="he";
    var content="<input type=button value='TEST' οnclick='helll(\""+name+"\")'  />";
    $("#hello").html(content);
}
function helll(name){
    alert(name);
    this.func=new Function(name+"();");
    func();
}
function he(){
alert("hell");
}
第二种方式
function hello(){
    var name="he";
    var content="<input type=button value='TEST' οnclick='helll(\""+name+"\")'  />";
    $("#hello").html(content);
}
function helll(name){
    alert(name);
    func=function(data){};
    this.func = eval(name);
    func("hel");
}
function he(name){
alert("hell"+name);
}
</script>

转载于:https://www.cnblogs.com/a757956132/p/4065471.html

你可能感兴趣的文章
[C#] SHA1校验函数用法
查看>>
linux 下 VMware 提示Unable to change virtual machine power state:
查看>>
洛谷P1585 魔法阵
查看>>
线程 题待做
查看>>
PL/SQL可以连oracle,但是jdbc连不上 【转】
查看>>
使用 highlight.js 在网页中高亮显示java 代码 【原】
查看>>
[转]高颜值、好用、易扩展的微信小程序 UI 库,Powered by 有赞
查看>>
[转]SQL Server如何启用xp_cmdshell组件
查看>>
[转]微擎应用笔记3--manifest.xml文件使用说明
查看>>
Codeforces 1000C Covered Points Count 【前缀和优化】
查看>>
python高效读取文件、文件改写
查看>>
gulp
查看>>
pgsql查询优化之模糊查询
查看>>
[转]-Gradle使用手册(三):构建任务
查看>>
ExtJS下拉树
查看>>
android 调用系统相机录像并保存
查看>>
BW系统表的命名规则
查看>>
Asp.Net在IE10下出现_doPostBack未定义的解决办法 LinkButton
查看>>
《CLR via C#》Part2之Chapter5 基元类型、引用类型和值类型(一)
查看>>
1-9 RHEL7-文件权限管理
查看>>