[求助] javascript创建元素添加事件问题
<script type="text/javascript"><BR><BR> function text()<BR>{<BR> alert();<BR>}<BR><BR>function createItem()<BR>{<BR> table = document.createElement("Table")<BR> <FONT color=#ff0000> table.onclick = function(){text();}</FONT><BR> body.appendChild(table)<BR>}<BR><BR></script><BR><BR>这里的红色部分为什么不行啊,帮我看看<BR><BR>function text()
{
alert();
}
function createItem()
{
table = document.createElement("Table")
[color=black]table.onclick = function(){text();}[/color]
[color=red]document.[/color]body.appendChild(table)
}
</script> function text()
{
alert("1");
}
页:
[1]
