1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
<
style
>
.fl{float:left;}
.fr{float:right;}
</
style
>
<
div
class
=
"box03"
id
=
"abc"
>
<
dl
>1</
dl
>
<
dl
>1</
dl
>
<
dl
>1</
dl
>
</
div
>
<
script
type
=
"text/javascript"
>
var objName=document.getElementById("abc").getElementsByTagName("dl");
for (i=0;i<
objName.length
;i++) {
(i%2==0)?(objName[i].className = "fl"):(objName[i].className = "fr");
}
</script>
|
本文转自 gutaotao1989 51CTO博客,原文链接:http://blog.51cto.com/taoyouth/1415463