本帖最后由 NineTyNine_LP 于 2014-12-05 18:03:03 编辑

解决方案 »

  1.   


    showName({"name":"zhangsan","age":30})这是返回的js代码
      

  2.   

    var showName = function(person){
    document.open();
    document.write(person.name);
            alert(person.name);
        };
      

  3.   

    看看是不是你创建的script标记在showname函数前面啦。
    你后创建的script标记得在showname下面才行。
    就是得在代码第18行下面。
      

  4.   


    是在showName的后面添加的script标签。
      

  5.   


    我console.log一下,发现showName是执行的。但是document.write不能在页面上打印。
      

  6.   


    我在代码里加上上document.open()后就可以在页面上打印出值了。
    但不明白这是为啥?
    能够给讲解一下?
      

  7.   

    页面加载完后输出流已经关闭,document.write就没有效果了