"LI Value Discoloration" code

xiaoxiao2021-04-06  259

I asked this question in a classic forum, I just tried the table interlacing, Li didn't tried it, but it was not difficult, so I wrote the following code, realize this function, I have collected my collection. Woke up.

DOCTYPE HTML PUBLIC "- // w3c // DTD HTML 4.0 Transitional // En"

>

<

HTML

>

<

HEAD

>

<

Title

>

New document

Title

>

<

Meta

Name

= "Generator"

Content

= "Editplus"

>

<

Meta

Name

= "Author"

Content

= ""

>

<

Meta

Name

= "Keywords"

Content

= ""

>

<

Meta

Name

= "Description"

Content

= ""

>

<

Style

Type

= "Text / CSS"

>

.style1

{

Color

:

# f00

;

BACKSID

:

#eee

}

.style2

{

Color

:

# 00F

;

BACKGROUND

:

#CCC

}

Style

>

<

Script

Type

= "Text / JavaScript"

>

FUNCTION

CHGListStyle (ID) {

VAR

Objid

=

Document.getlementByID (ID);

IF

(Objid) {

for

(

VAR

i

=

0

Objid.childNodes [i]

! =

Undefined; i

) {

IF

(i

%

2

==

0

) Objid.childNodes [i] .classname

=

"

STYLE1

"

;

Else

Objid.childNodes [i] .classname

=

"

STYLE2

"

}}}

Script

>

HEAD

>

<

Body

>

<

UL

id

= "a"

>

<

li

>

Test

li

>

<

li

>

Test

li

>

<

li

>

Test

li

>

<

li

>

Test

li

>

<

li

>

Test

li

>

UL

>

<

Script

Type

= "Text / JavaScript"

>

ChglistStyle

"

a

"

);

Script

>

Body

>

HTML

>

转载请注明原文地址:https://www.9cbs.com/read-132294.html

New Post(0)