dennis-the-menace01: for-Schleife

Beitrag lesen

Hallo Cheatah,

geht trotzdem nicht.

Hier mal der ganze Quelltext. Hat noch jemand eine Idee? Ich möcht's halt verstehen.

<HEAD>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<META NAME="GENERATOR" Content="Microsoft DHTML Editing Control">
<TITLE>BW Web Application</TITLE>
<script type="text/javascript">
function test() {
var value = document.getElementById('TEST').firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.childNodes[0].nodeValue;
alert(value);
}
</script>
<script type="text/javascript">
function get_it() {
var anzahl = document.getElementById('TEST').firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.childNodes.length;
alert(anzahl);
for (i=1; i <= anzahl; ++i) {
alert(i);
var value = document.getElementById('TEST').firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.childNodes[i].nodeValue;
alert(value);
}
}
</script>
</HEAD>
<BODY>
<P ID="TEST" >
<span id="SAP_BW_SNIPPET3">
<table width="300" border="0" cellpadding="0" cellspacing="0"><tr><td class="SAPBEXTableGrid" >
<table width="300" name="TABLE_1" class="SAPBEXCellspacing" border="0"  cellspacing="1" cellpadding="0" ><tr><td nowrap class="SAPBEXstdItem">MT OTHERS</td>
</tr><tr><td nowrap class="SAPBEXstdItem">MT-AS-GMS</td>
</tr><tr><td nowrap class="SAPBEXstdItem">MT-DC</td>
</tr><tr><td nowrap class="SAPBEXstdItem">MT-DS-TGM</td>
</tr><tr><td nowrap class="SAPBEXstdItem">ST OTHERS</td>
</tr><tr><td nowrap class="SAPBEXstdItem">ST-BUII</td>
</tr><tr><td nowrap class="SAPBEXstdItem">#</td>
</tr></table>
</td>
</tr>
</table>
</span>
</P>
       <P>     <A href="javascript:get_it()">alert</A></P>
       <P>     <A href="javascript:test()">direkt</A></P>
</BODY>
</HTML>