js 不执行
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Demo_For_Wang</title>
<script type="text/javascript">
function changeColor(){
//取获取table的对象
var t=document.getElementById("table1").childNodes.item(0);
//遍历table每一个单元格,将其背景色清空(事实上是设置为白色)
for(var i=0;i< t.childNodes.length;i++)
{
for(var j=0;j<t.childNodes(i).childNodes.length;j++)
{
t.childNodes(i).childNodes(j).bgColor="white";
}
}
//获取点击的超链接所在的单元格对象
var cell = event.srcElement.parentElement;
//设置背景为红色
cell.bgColor = "red";
}
</script>
</head>
<body>
<table border="1px" id="table1">
<tr>
<td id="td1">
<a href="#" target="_blank" onclick="changeColor()">google</a>
</td>
<td id="td2">
<a href="#" target="_blank" onclick="changeColor()">baidu</a>
</td>
<td id="td3">
<a href="#" target="_blank" onclick="changeColor()">douban</a>
</td>
<td id="td4">
<a href="#" target="_blank" onclick="changeColor()">renren</a>
</td>
</tr>
</table>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Demo_For_Wang</title>
<script type="text/javascript">
function changeColor(){
//取获取table的对象
var t=document.getElementById("table1").childNodes.item(0);
//遍历table每一个单元格,将其背景色清空(事实上是设置为白色)
for(var i=0;i< t.childNodes.length;i++)
{
for(var j=0;j<t.childNodes(i).childNodes.length;j++)
{
t.childNodes(i).childNodes(j).bgColor="white";
}
}
//获取点击的超链接所在的单元格对象
var cell = event.srcElement.parentElement;
//设置背景为红色
cell.bgColor = "red";
}
</script>
</head>
<body>
<table border="1px" id="table1">
<tr>
<td id="td1">
<a href="javascript:changeColor('google')" target="_blank">google</a>
</td>
<td id="td2">
<a href="javascript:changeColor('baidu')" target="_blank" >baidu</a>
</td>
<td id="td3">
<a href="javascript:changeColor('douban')" target="_blank" >douban</a>
</td>
<td id="td4">
<a href="javascript:changeColor('renren')" target="_blank" >renren</a>
</td>
</tr>
</table>
</body>
</html>
为什么下面的程序不合适啊? <a href="#" onclick="js()"> 与 <a href="javascript:js()">的区别是什么啊?