这篇文章主要介绍了关于php二维数组根据某一字段去重或统计的小技巧,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下
这是原来的CSS样式 
.item{float:left;overflow:hidden;margin-left:8px;margin-top:10px;width: 320px; height: 
250px;background-repeat: no-repeat; background-image:url(../images/bgred.jpg)} 
.curve{position:relative;width:320px; height:250px; z-index:1; left: 75px; top: -40px;}动态创建p代码如下: 
for(j = 0;j*8 <str.length; j++) 
{ 
var myp = window.frames["displayFrame"].document.createElement("p"); 
myp.setAttribute("id","itemp"+j); 
myp.style.styleFloat="left"; 
myp.style.overflow="hidden"; 
myp.style.marginLeft="8px"; 
myp.style.marginTop="10px"; 
myp.style.width="320px"; 
myp.style.height="250px"; 
myp.style.backgroundRepeat="no-repeat"; 
myp.style.backgroundImage="url(image/bgred.jpg)" 
window.frames["displayFrame"].document.body.appendChild(myp); 
var curvep =window.frames["displayFrame"].document.createElement("p"); 
curvep.setAttribute("id","curvep"+j); 
curvep.style.position="relative"; 
curvep.style.zIndex=1; 
curvep.style.left="75px"; 
curvep.style.top="-40px"; 
curvep.style.width="320px"; 
curvep.style.height="250px"; 
window.frames["displayFrame"].document.getElementById("pitem"+j).appendChild(curvep); 
}把p元素增加到HTML里面. 
也可在HTML里面定义一个SPAN 
window.frames["displayFrame"].document.getElementById("spanId").appendChild(myp); 
window.frames["displayFrame"].document.body.appendChild(myp);IE和Firefox都支持. 
另外需要注意的是这个CSS元素 
浮动效果:float:left 
在IE下代码为:myp.style.styleFloat="left"; 
在Firefox代码为: myp.style.cssFloat="left"; 
其他的诸如这种元素: 
在CSS编写中一般是:margin-left:8px 
而在动态增加需要去掉- :myp.style.marginLeft="8px"; 
关于大小写敏感问题没有仔细研究.
以上就是本文的全部内容,希望对大家的学习有所帮助,更多相关内容请关注PHP中文网!
相关推荐:
以上就是如何利用Js动态创建div的详细内容,更多请关注php中文网其它相关文章!
                        
                        每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
                Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号