Eric S.: Zugriff auf Elternelement klappt nicht

Beitrag lesen

Der Code:

function Plan() {  
	for ( j = 0; j < scma.length; j++ ) {  
		var forscma = scma[j];  
		if ( opt_sichtbar[j] == "Yes" ) {  
			var varj = j;  
			document.write('<table border="0" style="border-collapse:collapse" class="body-dienstplan">');  
			document.write('<tr><td class="body-geb b"><input class="input-geb" size="8" value="' + forscma[2] + '"></td><td class="body-tage">&nbsp;</td><td class="body-tage">01</td><td class="body-tage">02</td>/* ### Diverse Spalten, alle gleich / Code gekürzt ### */<td class="body-tage">29</td><td class="body-tage">30</td><td class="body-tage">31</td><td class="body-std b">Stunden</td></tr>');  
			document.write('<tr><td class="body-name"><input class="input-name" size="15" value="' + forscma[0] + '"></td><td class="body-FS b">F</td>');  
			var ausgabe = "";  
			var tag = 0;  
			for ( i = 3; i < forscma.length; i = i + 2 ) {  
				var vari = i;  
				ausgabe = forscma[i] + "\n";  
				if ( ausgabe == 0 ) { ausgabe = "&nbsp;"; }  
				tag++;  
				var datum = new Date(jahr, monat, tag);  
				var wochentag = datum.getDay();	  
				/* Bewegliche Feiertage von 2014 bis 2024 */		  
				if 	    ( tag == 18 && monat == 3 && jahr == 2014 ) { feiertag = "true" }  
				/*....  
				#### Hier stehen diverse Feiertage / Code gekürzt ###  
				....*/  
				else    { feiertag = "false" }  
				/* Backgroundcolor für Feiertage, Sonntage, Wochentage */			  
				if 		( wochentag == 0 && feiertag == "false" ) { var bgcolor = color_sonntag;	}  
				else if ( wochentag == 0 && feiertag == "true" ) { var bgcolor = color_feiertag; }  
				else if ( wochentag != 0 && feiertag == "true" ) { var bgcolor = color_feiertag; }  
				else if ( wochentag == 0 && feiertag == "zu" ) { var bgcolor = color_zu; }  
				else if ( wochentag != 0 && feiertag == "zu" ) { var bgcolor = color_zu; }  
				else 	{ var bgcolor = color_neutral; }  
				if ( scmac[j][i] != 0 ) { var bgcolor = eval("color_extra"+scmac[j][i]); }  
					document.write('<td style="background-color: ' + bgcolor + ';" class="body-input"><input class="input-std" style="background-color: ' + bgcolor + ';" onfocus="this.select()" ondblclick="this.nextSibling.style.display=\'block\'" onchange="scma['+j+']['+i+']=this.value;Summe('+j+')" onblur="this.nextSibling.style.display=\'none\'" value="'+ausgabe+'"><div class="ddmenu" style="display: none;"><ul>'  
					+'<li class="ddsubmenu"><div class="ddbox" style="background-color:'+color_neutral+';" onclick="insert('+j+', '+i+', 0);this.parentNode.parentNode.parentNode.parentNode.style.backgroundColor=\'' + color_neutral + '\'; this.parentNode.parentNode.parentNode.parentNode.childNodes[0].style.backgroundColor=\'' + color_neutral + '\';this.parentNode.parentNode.parentNode.style.display=\'none\';">&nbsp;</div></li>'				  
					+'<li class="ddsubmenu"><div class="ddbox" style="background-color:'+color_extra1+';" onclick="insert('+j+', '+i+', 1);this.parentNode.parentNode.parentNode.parentNode.style.backgroundColor=\'' + color_extra1 + '\'; this.parentNode.parentNode.parentNode.parentNode.childNodes[0].style.backgroundColor=\'' + color_extra1 + '\';this.parentNode.parentNode.parentNode.style.display=\'none\';">&nbsp;</div></li>'  
					+'<li class="ddsubmenu"><div class="ddbox" style="background-color:'+color_extra2+';" onclick="insert('+j+', '+i+', 2);this.parentNode.parentNode.parentNode.parentNode.style.backgroundColor=\'' + color_extra2 + '\'; this.parentNode.parentNode.parentNode.parentNode.childNodes[0].style.backgroundColor=\'' + color_extra2 + '\';this.parentNode.parentNode.parentNode.style.display=\'none\';">&nbsp;</div></li>'  
					+'<li class="ddsubmenu"><div class="ddbox" style="background-color:'+color_extra3+';" onclick="insert('+j+', '+i+', 3);this.parentNode.parentNode.parentNode.parentNode.style.backgroundColor=\'' + color_extra3 + '\'; this.parentNode.parentNode.parentNode.parentNode.childNodes[0].style.backgroundColor=\'' + color_extra3 + '\';this.parentNode.parentNode.parentNode.style.display=\'none\';">&nbsp;</div></li>'  
					+'<li class="ddsubmenu"><div class="ddbox" style="background-color:'+color_extra4+';" onclick="insert('+j+', '+i+', 4);this.parentNode.parentNode.parentNode.parentNode.style.backgroundColor=\'' + color_extra4 + '\'; this.parentNode.parentNode.parentNode.parentNode.childNodes[0].style.backgroundColor=\'' + color_extra4 + '\';this.parentNode.parentNode.parentNode.style.display=\'none\';">&nbsp;</div></li>'  
					+'<li class="ddsubmenu"><div class="ddbox" style="background-color:'+color_extra5+';" onclick="insert('+j+', '+i+', 5);this.parentNode.parentNode.parentNode.parentNode.style.backgroundColor=\'' + color_extra5 + '\'; this.parentNode.parentNode.parentNode.parentNode.childNodes[0].style.backgroundColor=\'' + color_extra5 + '\';this.parentNode.parentNode.parentNode.style.display=\'none\';">&nbsp;</div></li>'  
					+'<li class="ddsubmenu"><div class="ddbox" style="background-color:'+color_extra6+';" onclick="insert('+j+', '+i+', 6);this.parentNode.parentNode.parentNode.parentNode.style.backgroundColor=\'' + color_extra6 + '\'; this.parentNode.parentNode.parentNode.parentNode.childNodes[0].style.backgroundColor=\'' + color_extra6 + '\';this.parentNode.parentNode.parentNode.style.display=\'none\';">&nbsp;</div></li>'  
					+'<li class="ddsubmenu"><div class="ddbox" style="background-color:'+color_extra7+';" onclick="insert('+j+', '+i+', 7);this.parentNode.parentNode.parentNode.parentNode.style.backgroundColor=\'' + color_extra7 + '\'; this.parentNode.parentNode.parentNode.parentNode.childNodes[0].style.backgroundColor=\'' + color_extra7 + '\';this.parentNode.parentNode.parentNode.style.display=\'none\';">&nbsp;</div></li>'  
					+'<li class="ddsubmenu"><div class="ddbox" style="background-color:'+color_extra8+';" onclick="insert('+j+', '+i+', 8);this.parentNode.parentNode.parentNode.parentNode.style.backgroundColor=\'' + color_extra8 + '\'; this.parentNode.parentNode.parentNode.parentNode.childNodes[0].style.backgroundColor=\'' + color_extra8 + '\';this.parentNode.parentNode.parentNode.style.display=\'none\';">&nbsp;</div></li>'  
					+'<li class="ddsubmenu"><div class="ddbox" style="background-color:'+color_extra9+';" onclick="insert('+j+', '+i+', 9);this.parentNode.parentNode.parentNode.parentNode.style.backgroundColor=\'' + color_extra9 + '\'; this.parentNode.parentNode.parentNode.parentNode.childNodes[0].style.backgroundColor=\'' + color_extra9 + '\';this.parentNode.parentNode.parentNode.style.display=\'none\';">&nbsp;</div></li>'  
					+'</ul></div></td>');  
			}  
			  
/* ### Hier steht eine 2. Schleife, die praktisch Identisch ist mit der obigen ### */  
  
			var sum = 0;  
			for ( i = 4; i < forscma.length; i++ ) {  
			sum += forscma[i];  
			}  
			document.write('<td id="summe'+j+'" class="body-anzahl">'+sum+'</td></tr></table>');			  
		}  
		else {  
			document.write('<div class="leer">&nbsp;</div>');  
		}  
	}  
}

var scma und var scmac sind jeweils 2 Dimensionale Arrays, die angesprochenen Variablen stimmen alle - Seltsamerweise hat es gestern funktioniert, warum jetzt nicht weiss ich nicht, vllt hab ich versehentlich irgendwas geändert was garnicht sein sollte ^^""" nur finde ich den Fehler einfach nicht