JS 类的问题
<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>
在IE中只显示this._div_h.innerHTML=this.name+this._id;
的内容,在firefox中本来是能正确运行正确的(能看到背景),但我试着用JSON写完再改回来就什么也不显示了
望大侠指点一下,不胜感激
...全文
相关推荐
Net的Gzip压缩类 compressionmodule ,解决js中文压缩问题
很好用的asp.net压缩类,可以压缩aspx,js,css,axd等文件
JavaScript中的类继承问题及解决方法
在JavaScript中,类继承是一种重要的概念,它允许我们创建一个类,并从其他类中继承属性和方法。需要注意的是,本文介绍的解决方法是针对Node.js环境下的类继承问题。为了解决Node.js中的类继承问题,我们可以使用第三方库或ES6中的一些新特性。下面我们将介绍两种主要的解决方法。虽然在早期版本的Node.js中存在类继承问题,但我们可以通过使用第三方库或ES6的语法来解决这个问题。库或ES6的类继承语法,我们可以轻松地实现类继承,并在Node.js环境中编写更具可维护性和可扩展性的代码。
解决javascript中的浮点数计算不精确问题
NULL 博文链接:https://xide829.iteye.com/blog/663554
一个JS类(收藏)
prototype.js开发者手册 博文链接:https://ghost-fly.iteye.com/blog/97263
php封装js类,很好用的
php封装js类和地图api一些源代码,希望对大家有用


