How to dynamically create divs using Js

不言
Release: 2018-06-25 09:17:30
Original
2340 people have browsed it

This article mainly introduces tips on deduplication or statistics of PHP two-dimensional arrays based on a certain field. It has a certain reference value. Now I share it with you. Friends in need can refer to it

This is the original CSS style

.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;}
Copy after login

The code for dynamically creating p is as follows:

for(j = 0;j*8 
        
Copy after login

Add the p element to HTML.
You can also define one in HTML SPAN

window.frames["displayFrame"].document.getElementById("spanId").appendChild(myp); window.frames["displayFrame"].document.body.appendChild(myp);
Copy after login

Both IE and Firefox support it.
Another thing to note is this CSS element
Floating effect: float:left
The code under IE is: myp.style. styleFloat="left";
The code in Firefox is: myp.style.cssFloat="left";
Other elements such as this:
In CSS writing, it is usually: margin-left:8px
And when adding dynamically, it needs to be removed - :myp.style.marginLeft="8px";
There is no careful study on the case sensitivity issue.

The above is the entire content of this article, I hope it will be helpful to Everyone’s learning is helpful. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

How to call related classes in JavaScript

How to generate an arithmetic sequence using JavaScript

The above is the detailed content of How to dynamically create divs using Js. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!