52,797
社区成员
发帖
与我相关
我的任务
分享
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>无标题页</title>
<style type="text/css">
.game{ width:80px;height:110px;border:1px solid #BAD1FC; background:url(hhh.gif);}
.game head{}
.game foot{}
</style>
</head>
<body>
<script type="text/jscript">
function person(id,name,x,y){
this._id=id;
this.name=name;
this._x=x;
this._y=y;
this._bl=1;
this._m=1;
}
person.prototype.getdiv =function(){
if(document.getElementById(this._id))
{
this._div=document.getElementById(this._id);
} else
{
try{
this._div=document.createElement("div");
this._div.id=this._id;
document.body.appendChild(this._div);
this._div_h=document.createElement("div");
this._div_f=document.createElement("div");
this._div.appendChild(this._div_h);
this._div.appendChild(this._div_f);
this._div.style.position="absolute";
this._div.style.top=this._y+"px";
this._div.style.left=this._x+"px";
this._div.setAttribute("class","game");
//this._div.innerHTML="success";
this._div_h.setAttribute("class","head");
this._div_f.setAttribute("class","foot");
this._div_h.innerHTML=this.name+this._id;
}catch(e){return false;}
}
}
var a= new person('eric','shmily','88','400');
a.getdiv();
</script>
</body>
</html>
document.body.appendChild(this._div);
this._div_h=document.createElement("div");
this._div_f=document.createElement("div");
this._div.appendChild(this._div_h);
this._div.appendChild(this._div_f);
document.body.appendChild(this._div);
this._div_h=document.createElement("div");
this._div_f=document.createElement("div");
this._div.appendChild(this._div_h);
this._div.appendChild(this._div_f);