87,990
社区成员
发帖
与我相关
我的任务
分享<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script type="text/javascript">
function getObjectRef(name) {
if (document.getElementById) return document.getElementById(name);
else if (document.all) return document.all[name];
else return null;
}
function Object() {
document.write("<div id='obj' style='width:10px;height:10px;background-color:red;'></div>");
this.obj = "obj";
var self = this;
this.showText = function () {
getObjectRef(self.obj).innerHTML = "3123123";
}
this.initEvent = function(){
getObjectRef(self.obj).onmouseover = self.showText;
}
// getObjectRef(this.obj).onmouseover = this.showText;
}
var obj1=new Object();
function init(){
obj1.initEvent()
}
</script>
</HEAD>
<BODY onload="init()">
</BODY>
</HTML>