Stefan: Dynamische Zebrastreifentabelle in IE gehts, wie in NN4?

Beitrag lesen

How can this script be functional with layers in NN4?

This script automatically alternates colors of table rows (one color for evens, one for odds) dynamically, meaning that no statically numbered names oder IDs have to be given to the rows. So rows can be deleted and inserted and the color stripes stay organized. There is no document.write command used, so the table can be edited WYSIWYGly in HTML-Editors as Dreamweaver.

Yours, Stefan Minder, University of Bern http://studmed.unibe.ch

<HTML>

<HEAD>

</HEAD>

<BODY>

<TABLE WIDTH=75% BORDER=1 CELLSPACING=1 CELLPADDING=1>

<TR NAME="construction_fields" ID="construction_fields">

<TD>Row 1</TD><TD>Row 1</TD><TD>Row 1</TD>

</TR>

<TR NAME="construction_fields" ID="construction_fields">

<TD>Row 2</TD><TD>Row 2</TD><TD>Row 2</TD>

</TR>

<TR NAME="construction_fields" ID="construction_fields">

<TD>Row 3</TD><TD>Row 3</TD><TD>Row 3</TD>

</TR>

<TR NAME="construction_fields" ID="construction_fields">

<TD>next Row</TD><TD>next Row</TD><TD>next Row</TD>

</TR>

<TR NAME="construction_fields" ID="construction_fields">

<TD>next Row</TD><TD>next Row</TD><TD>next Row</TD>

</TR>

<TR NAME="construction_fields" ID="construction_fields">

<TD>next Row</TD><TD>next Row</TD><TD>next Row</TD>

</TR>

<TR NAME="construction_fields" ID="construction_fields">

<TD>next Row</TD><TD>next Row</TD><TD>next Row</TD>

</TR>

</TABLE>

<SCRIPT>

var z=1;

function zebra(){

var objConstrFields = document.getElementsByName("construction_fields");

for(i=0;i<objConstrFields.length;i++){

z=z*-1;

if (z==1) objConstrFields[i].style.background='blue';

else objConstrFields[i].style.background='red';

}

}

function layzebra(){

// How would be the Zebrafunction for NN4 (with layers)

}

if (document.layers) layzebra();

else zebra();

</SCRIPT>

</BODY>

</HTML>

---
INFORMATION FÜR DOZIERENDE: Grosse Dateien können Sie uns auf http://studmed.unibe.ch/upload zustellen, da die Dateigrössen im E-Mailverkehr limitiert sind. Mehr Infos auf http://studmed.unibe.ch/tipps/tipps.htm
---

Stefan Minder
Web-Publisher
Inselspital 38
3010 Bern
Tel. 031 632 49 62
studmed@aum.unibe.ch

Kurs «Internetseiten herstellen»:
http://www.esdi.unibe.ch

Anwesenheitsplan AUM
http://studmed.unibe.ch/sm