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 ;}
The code for dynamically creating a DIV is as follows:
For (j = 0; j * 8 <str. length; j ++)
{
Var mydiv = window. frames ["displayFrame" comment .doc ument. createElement ("div ");
Mydiv. setAttribute ("id", "itemdiv" + j );
Mydiv. style. styleFloat = "left ";
Mydiv. style. overflow = "hidden ";
Mydiv. style. marginLeft = "8px ";
Mydiv. style. marginTop = "10px ";
Mydiv. style. width = "320px ";
Mydiv. style. height = "250px ";
Mydiv. style. backgroundRepeat = "no-repeat ";
Mydiv. style. backgroundImage = "url (image/bgred.jpg )"
Window. frames ["displayFrame" mirror.doc ument. body. appendChild (mydiv );
Var curvediv = window. frames ["displayFrame" comment .doc ument. createElement ("div ");
Curvediv. setAttribute ("id", "curvediv" + j );
Curvediv. style. position = "relative ";
Curvediv. style. zIndex = 1;
Curvediv. style. left = "75px ";
Curvediv. style. top = "-40px ";
Curvediv. style. width = "320px ";
Curvediv. style. height = "250px ";
Window. frames ["displayFrame" mirror.doc ument. getElementById ("divitem" + j). appendChild (curvediv );
}
Add the div element to HTML.
You can also define a SPAN in HTML.
Window. frames ["displayFrame" mirror.doc ument. getElementById ("spanId"). appendChild (mydiv );
Window. frames ["displayFrame" mirror.doc ument. body. appendChild (mydiv );
Both IE and Firefox support.
Note that this CSS Element
Floating effect: float: left
Code in IE: mydiv. style. styleFloat = "left ";
The code in Firefox is: mydiv.style.css Float = "left ";
Other elements such:
In CSS writing, it is generally: margin-left: 8px
In addition, we need to remove-: mydiv. style. marginLeft = "8px ";
I have not carefully studied the case sensitivity issue.