8.7w+
社区成员
<!DOCTYPE html>
<html>
<head>
<script>
function load(){
window.location.href('#divElement');
}
function activate(){
alert("activated.");
}
</script>
</head>
<body onload="load()">
<table onactivate="activate()">
<div id="divElement" ></div>
</table>
</body>
</html>
<html>
<script>
function test()
{
var id_0 = document.createElement("table");
var id_1 = document.createElement("div");
id_1.setAttribute("id","divElement");
document.body.appendChild(id_0);
docuemnt.body.appendChild(id_1);
id_1.applyElement(id_0);
id_0.onactivate = function(e){
alert("activated.");
}
window.location.href('#divElement');
}
window.onload = function() {
test();
}
</script>
</html>