<html>
<head>
<title>
TestJs
</title>
</head>
<body>
<script type="text/javascript">
document.write(" <a href='#' onclick='document.getElementById(\"setid\").style.display= \"\";document.getElementById(\"setid\").innerHTML=\"OK\";'>点击看看 </a>");
document.write(" <div id='setid' style='display:none;'>kankan </div>");
</script>
</body>
</html>是innerHTML 啊.
<head>
<title>
TestJs
</title>
</head>
<body>
<script type="text/javascript">
document.write(" <a href='#' onclick='document.getElementById(\"setid\").style.display= \"\";document.getElementById(\"setid\").innerHTML=\"OK\";'>点击看看 </a>");
document.write(" <div id='setid' style='display:none;'>kankan </div>");
</script>
</body>
</html>是innerHTML 啊.
ie 的话 把显示脚本错误勾上ff 或者 其它也需要类似设置
你的代码的效果是给document.getElementById("setid")添了个新的属性,不信你用下面的代码测试一下
javascript:alert(document.getElementById("setid").innerHtml);
肯定可以输出ok