zoukankan      html  css  js  c++  java
  • js奇葩错误 字符串传递问题

    第一种方式
    function hello(){
        var name="he";
        var content="<input type=button value='TEST' onclick='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' onclick='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>

  • 相关阅读:
    测光
    闪光灯
    快门
    光圈
    白加黑减
    曝光补偿
    取景雷区
    着眼点
    Web中的无状态含义
    图计算模型[转]
  • 原文地址:https://www.cnblogs.com/a757956132/p/4065471.html
Copyright © 2011-2022 走看看