functie in area

Status
Niet open voor verdere reacties.

justmehaxe

Gebruiker
Lid geworden
12 aug 2001
Berichten
605
heyz,

bij de volgende code wil de functie schrijftafel laten weergeven in de Textarea name=tekst1 Mijn vraag is HOE!

html>
<head>

<script language="JavaScript">

function schrijftafel(start,tafel,eind)
{


for(i=start; i<=eind; i++)
{

document.write(i + ' maal ' + tafel + ' = ' + i*tafel + '<Br>')
document.bgColor = 'blue'
}

}



</script>

</head>

<body bgcolor="purple">
<H1><b>Rekenprogramma</b></h1><br>
<form name="formpje">
<input type=button name="1" value="Tafel 1" onClick="schrijftafel(1,1,10)">
<input type=button name="2" value="Tafel 2" onClick="schrijftafel(1,2,10)">
<input type=button name="3" value="Tafel 3" onClick="schrijftafel(1,3,10)">
<input type=button name="4" value="Tafel 4" onClick="schrijftafel(1,4,10)">
<input type=button name="5" value="Tafel 5" onClick="schrijftafel(1,5,10)">
<input type=button name="6" value="Tafel 6" onClick="schrijftafel(1,6,10)">
<input type=button name="7" value="Tafel 7" onClick="schrijftafel(1,7,10)">
<input type=button name="8" value="Tafel 8" onClick="schrijftafel(1,8,10)">
<input type=button name="9" value="Tafel 9" onClick="schrijftafel(1,9,10)">
<input type=button name="10" value="Tafel 10" onClick="schrijftafel(1,10,10)">
<br><Br>

<textarea name="tekst1" cols=15 rows=15>
</textarea>



</form>
</body>

</html>
 
Zoiets?

Code:
<html> 
<head> 

<script language="Javascript"> 
function schrijftafel(start,tafel,eind) {
	document.formpje.tekst1.value = '';
	for(i=start; i<=eind; i++) {
		document.formpje.tekst1.value += i + ' maal ' + tafel + ' = ' + i*tafel + '\n';
//		document.write(i + ' maal ' + tafel + ' = ' + i*tafel + '<Br>') 
//		document.bgColor = 'blue' 
	} 
} 
</script> 
</head> 
<body bgcolor="purple"> 
<H1><b>Rekenprogramma</b></h1><br> 
<form name="formpje"> 
<input type=button name="1" value="Tafel 1" onClick="schrijftafel(1,1,10)">
<input type=button name="2" value="Tafel 2" onClick="schrijftafel(1,2,10)">
<input type=button name="3" value="Tafel 3" onClick="schrijftafel(1,3,10)">
<input type=button name="4" value="Tafel 4" onClick="schrijftafel(1,4,10)">
<input type=button name="5" value="Tafel 5" onClick="schrijftafel(1,5,10)">
<input type=button name="6" value="Tafel 6" onClick="schrijftafel(1,6,10)">
<input type=button name="7" value="Tafel 7" onClick="schrijftafel(1,7,10)">
<input type=button name="8" value="Tafel 8" onClick="schrijftafel(1,8,10)">
<input type=button name="9" value="Tafel 9" onClick="schrijftafel(1,9,10)">
<input type=button name="10" value="Tafel 10" onClick="schrijftafel(1,10,10)">
<br><br>
<textarea name="tekst1" cols=20 rows=15></textarea>
</form>
</body>
</html>
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan