js创建点击事件中<a>标签onclick传递多个参数

var rowIndex = e.rowIndex;  
var t = "<a href='javascript:void(0)' onclick=\"viewInfo('" + rowIndex + "','" + '温度' + "')\">" + t + "</a> ";
var t = "<a href='javascript:void(0)' onclick=\"viewInfo('" + rowIndex + "','温度')\">"+t+"</a> "
var t = "<a href='javascript:void(0)' onclick=\"viewInfo('" + rowIndex + "','" + "温度" + "')\">" + t + "</a> ";
解析后:
"<a href='javascript:void(0)' onclick="viewInfo('1','温度')">27</a> "
var t = "<a href='javascript:void(0)' onclick='viewInfo(\"" + rowIndex + "\",\"" +'温度'+ "\")'>" + t + "</a> ";
var t = "<a href='javascript:void(0)' onclick='viewInfo(\"" + rowIndex + "\",\"" +"温度"+ "\")'>" + t + "</a> ";
var t = "<a href='javascript:void(0)' onclick='viewInfo(\"" + rowIndex + "\",\"温度\")'>" + t + "</a> ";

解析后:
var t = "<a href='javascript:void(0)' onclick='viewInfo("0","温度")'>72</a> "

 

posted @ 2017-05-09 10:27  雷雨天的雷胖子  阅读(22043)  评论(0编辑  收藏  举报