html里onclick方法传对象的方法

xiaoxiao2025-08-23  97

            var objJson = JSON.stringify(json_xx[i]);//对象转json字符串             objJson = objJson.replace(/\"/g, "'");//将转成的字符串里的双引号转成单引号,使html得以识别             html_zdry += '<div> '  + '" οnclick="tr_xx(' + objJson + ');" ></div>'          function tr_xx   (o){

alert(o.name);//即可获得值

}

转载请注明原文地址: https://www.6miu.com/read-5035157.html

最新回复(0)