本帖最后由 wealsh 于 2013-09-28 10:18:31 编辑

解决方案 »

  1.   


    /*   这注释掉
             content.innerHTML = str + "<a href='javascript:void(0)' onclick= 'alert(\"这里没有问题\") ' >点击查看</a>";  //这里可以弹对话框*/
                    content.innerHTML = str + "<a href='javascript:void(0)' onclick= 'showuser(\"不起作用\") ' >点击查看</a>";  //这里调用 showuser 函数不起作用,请问为什么?在 showuser 函数的第一行加 alert(1) 看看有没进入
      

  2.   

    没有,onclick= 'alert    就可以,改成我定义的函数都无效?
      

  3.   

    可能 你 showuser 没定义成功 showuser,或不是在window 下
    你直接在HTML里加 <button onclick="showuser('test')" > test </button> 试试 
      

  4.   

    unction content(str){var content = parent.frames['acount'].document.getElementById('content');
                    content.innerHTML = str ;showuser(str); //这里是可以调用的}
      

  5.   

    content 是在acount 页面 所以调用 不到 <script language="javascript">
    function showuser(str){         
              alert(str);
    }
    function content(str){
      acount=parent.frames['acount'];
    acount.showuser=showuser;
    var content =acount.document.getElementById('content');
     
     content.innerHTML = str + "<a href='javascript:void(0)' onclick= 'showuser(\"不起作用\") ' >点击查看</a>"; 
    }
    </script>
      

  6.   

    可以了,谢谢,不过还有个问题,参数赋值好像不行?
    function content(str,Str2){
      acount=parent.frames['acount'];
    acount.showuser=showuser;
    var content =acount.document.getElementById('content');
      
     content.innerHTML = str + "<a href='javascript:void(0)' onclick= 'showuser(Str2) ' >点击查看</a>"; 
    }
      

  7.   

     function content(str,Str2){
      acount=parent.frames['acount'];
    acount.showuser=showuser;
    var content =acount.document.getElementById('content');
      
     content.innerHTML = str + "<a href='javascript:void(0)' onclick= 'showuser(\"" + Str2+ "\") ' >点击查看</a>"; 
    }