function(data){
var idd=data.id;
var addchildbutton=document.createElement("<input type='button' onclick='addchild("+idd+")'>");
addchildbutton.setAttribute("name","addchild");
addchildbutton.setAttribute("value","addchild");
return addchildbutton;
}];我是用javascript写的一个button, 有一个事件 onclick='addchild ,我想点addchild的时候就弹出一个页面,而且里面要传参数id

解决方案 »

  1.   

    function addchild(){
      form1.action = "你的地址?id=你的id值";
    }



    <input type="button" value="xxx" onclick="addchild()">这样就可以了,具体细节你自己写吧。
      

  2.   


    function addchild()
    { form1.target="_blank";
      form1.action = "你的地址?id=你的id值"; 

      

  3.   

    你那是写Button呢,你明明是想追加一个Button,然后给onclick的事件里面传值进去!你慢慢写,一步步拼就可以了,注意单双引号就可以了!
      

  4.   

    js写button不能那样写吧var btn=document.createElement('input');
    btn.type='button';
    btn.onclick=function(){aaa};