JavaScript::textfelder problem

  • #1
F

firefuchs

Guest
Moin
weiß jemand was daran falsch ist?
Code:
<html>
<head>
<script type=text/javascript>
<!--
function dropFile(btn){
	if(document.getElementById) {
		tr = btn;
		while (tr.tagName !=->TR') tr = tr.parentNode;
		tr.parentNode.removeChild(tr);
		checkForLast();
	}
}

function addFile(btn){
	if(document.getElementById) {
		tr = btn;
		while (tr.tagName !=->TR') tr = tr.parentNode;
		var idSuffix = Math.round(Math.random()*1000);
		var newTr = tr.parentNode.insertBefore(tr.cloneNode(true),tr.nextSibling);
		thisChilds = newTr.getElementsByTagName('td');
		for (var i = 0; i < thisChilds.length; i++){
			if (thisChilds[i].className ==->header') thisChilds[i].innerHTML =->';
			if (thisChilds[i].className ==->files') thisChilds[i].innerHTML =-><input class=tbox style=width:79% size=47 name=link[] type=text>';
		}
		checkForLast();
	}
}
function checkForLast(){
	btns = document.getElementsByName('drop');
	for (i = 0; i < btns.length; i++){
		btns[i].disabled = (btns.length == 1) ? true : false;
	}
}


-->
</script>
</head>
<body>
<form method=POST action=weiter.php>
	<table>
		<tr>
			<td>
		<? 
		$i = 1;
		while($i < 10)
		{
			echoURL $i:<input type='text' size='50' name='link$i' value='link$i'>
				<input name='drop' value='-' onclick='dropFile(this);' type='button'>
				<input value='+' onclick='addFile(this);' type='button'><br><br>;
			$i++;
		} 
		?>

			</td>
		</tr>
	</table>
	<input type=submit value=senden name=senden>

</form>
</body>
</html>

Wollte das so machen dass wenn man auf + klickt ein neues Textfeld kommt, das dann z.B. Link6 heißt wenn das vorige Link5 heißt und dass der + Button disabled ist wenn 10 Felder da sind.
 
Thema:

JavaScript::textfelder problem

ANGEBOTE & SPONSOREN

Statistik des Forums

Themen
113.840
Beiträge
707.963
Mitglieder
51.494
Neuestes Mitglied
Flensburg45
Oben