javascript函数奇怪问题???在线等!!
下面的html页面是可以正常运行的,但是
将 var jadminid= "88888 "; 改为其他例如 var jadminid= "aaa "后;
在点 "查看信息 "时就报错了, 不知道为什么???
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN ">
<HTML>
<HEAD>
<TITLE> javascript </TITLE>
<script type= "text/javascript ">
function send()
{
var jarea= "北京 ";
var jname= "beijng ";
var jadminid= "88888 ";
var row = document.createElement( "tr ");
var cell = document.createElement( "td ");
cell.innerHTML =jarea;
row.appendChild(cell);
cell = document.createElement( "td ");
cell.innerHTML =jname;
row.appendChild(cell);
cell = document.createElement( "td ");
cell.innerHTML= " <a href= '# ' onClick= 'getadmindetail( "+jadminid+ ") '> "+ "查看信息 "+ " </a> ";
row.appendChild(cell);
show_admin.appendChild(row);
}
function getadmindetail(jadminid)
{
alert(jadminid);
}
</script>
</HEAD>
<BODY>
<input type= "button " value= "生成表格 " onClick= "send(); "/>
<table border=1>
<tbody id= "show_admin ">
</tbody>
</table>
</BODY>
</HTML>
------解决方案--------------------cell.innerHTML= " <a href= '# ' onClick= 'getadmindetail(\ " "+jadminid+ "\ ") '> 查看信息 </a> ";