|
|
Hallo zusammen ^^ Ich habe ein Script gemacht und benötige nun Hilfe.
Aber seht erstmal selbst.
Code:
<html>
<head>
<title>Wer mit wem?</title>
</head>
<body>
<h2>Wer mit Wem?</h2>
<script type="text/javascript">
// Sekundenzähler
var s = 0;
function Timer() {
document.formel7.time.value=s;
s++;
window.setTimeout('Timer()',1000) // Pause
}
</script>
<body onLoad="Timer()">
<form name="formel7">
<input type=text size=6 name="time">
</form>
<form name="pers1">
Kurt<input type=radio name=b><br>
Vreni<input type=radio name=b><br>
Hans<input type=radio name=b><br>
Peter<input type=radio name=b><br>
Tom<input type=radio name=b><br>
Lukas<input type=radio name=b><br>
</form>
<form name="janein">
liebt<input type=radio name=b><br>
mag<input type=radio name=b><br>
hasst<input type=radio name=b><br>
</form>
<form name="pers2">
Manuel<input type=radio name=b><br>
Stefanie<input type=radio name=b><br>
Tobias<input type=radio name=b><br>
Claudia<input type=radio name=b><br>
Mathias<input type=radio name=b><br>
Alexandra<input type=radio name=b><br>
</form>
<input type=button value="Verbinde!" onClick="Test()">
</form>
</body>
</html> |
Nun sollte es eine Textbox ganz am Schluss geben.
Wenn man nun zB wählt: Manuel mag Claudia . Dann kommt in der Box, wenn man *Verbinde* klickt, eine Kombination, die etwa so lautet: 1. Manuel mag Claudia.
Danach kann man weitere Paare machen und immer auf *Verbinde* klicken. Und es gibt dann eine Liste, die alle verbindungen anzeigt.
Wie mache ich das ôo
|
|
| 26.10.2007 19:43:01 |
|
HTMELL
Administrator
Registriert: 11.05.2006
Beiträge: 544
|
|
Hallo, na dann mach ich mal wieder Hausaufgaben ;-))
Code:
<html>
<head>
<title>Wer mit wem?</title>
<script type="text/javascript">
function Timer() {
document.forms[0].time.value++;
}
function test() {
var f = document.forms[0];
f.out.value+= getValue(f.a) + " " + getValue(f.b) + " " + getValue(f.c) + "\n";
}
function getValue(o) {
for(i=0; i<o.length; i++) {
if(o[i].checked) return o[i].value;
}
}
</script>
</head>
<body>
<h2>Wer mit Wem?</h2>
<body onLoad="setInterval('Timer()', 1000)">
<form>
<input type=text size=6 name="time" value="0">
<br><br>
Kurt<input type=radio name="a" value="Kurt"><br>
Vreni<input type=radio name="a" value="Vreni"><br>
Hans<input type=radio name="a" value="Hans"><br>
Peter<input type=radio name="a" value="Peter"><br>
Tom<input type=radio name="a" value="Tom"><br>
Lukas<input type=radio name="a" value="Lukas"><br>
<br>
liebt<input type=radio name=b value="liebt"><br>
mag<input type=radio name=b value="mag"><br>
hasst<input type=radio name=b value="hasst"><br>
<br>
Manuel<input type=radio name=c value="Manuel"><br>
Stefanie<input type=radio name=c value="Stefanie"><br>
Tobias<input type=radio name=c value="Tobias"><br>
Claudia<input type=radio name=c value="Claudia"><br>
Mathias<input type=radio name=c value="Mathias"><br>
Alexandra<input type=radio name=c value="Alexandra"><br>
<br>
<input type=button value="Verbinde!" onClick="test()"><br><br>
<textarea name="out"></textarea>
</form>
</body>
</html> |
_______________________________________ mfg Thomas Mell
www.validome.org
|
|
| 27.10.2007 00:57:41 |
|
|
|
oh, cool. =D
Danke vielmals für deine Hilfe.
Wenn cih wiedermal ein Problem habe. komme ich wieder hierher =D
|
|
| 29.10.2007 18:27:45 |
|
|
|
Hi wieder =)
Ich hab was falsch verstanden. Wir sollten es noch so einrichten, dass vor jeder Kombination noch eine Nummer steht: 1. X mag Y 2. A hasst B 3. B liebt X [...]
Wie macht man das? ôo
|
|
| 10.11.2007 15:01:32 |
|
HTMELL
Administrator
Registriert: 11.05.2006
Beiträge: 544
|
|
Hi, einfach die values erweitern, z. B. "Manuel#X", das "#" dient dabei als Trennzeichen. Mit o[x].split("#"); kannst Du dann den String wieder in seine beiden Einzelteile zerlegen und bekommst "Manuel" und "X" getrennt. Ab dann geht es einfach weiter.
_______________________________________ mfg Thomas Mell
www.validome.org
|
|
| 10.11.2007 16:04:44 |
|
|
|
Hmm ... haben wir uns jetzt falsch verstenden oder bin ich zu dumm ;D
Ich wollte mit dem Post oben sagen, dass es so aussehen soll: 1. Y liebt X 2. 3. 4. 5. 6. 7. 8. x. y. z. *unendlich*
Das was da steht ist egal. Ich will nur, dass es eine unendliche Reihe von Zahlen gibt, ohne, dass man noch etwas tun muss. Automatisch ;)
|
|
| 14.11.2007 15:53:10 |
|
HTMELL
Administrator
Registriert: 11.05.2006
Beiträge: 544
|
|
Hi, autsch, das habe ich mal total falsch verstanden. Aber so wie Du es willst, ist es noch einfacher - einfach einen Counter einbauen:
Code:
<script type="text/javascript">
var cnt = 0;
function Timer() {
document.forms[0].time.value++;
}
function test() {
var f = document.forms[0];
f.out.value+= ++cnt + ". " + getValue(f.a) + " " + getValue(f.b) + " " + getValue(f.c) + "\n";
}
function getValue(o) {
for(i=0; i<o.length; i++) {
if(o[i].checked) return o[i].value;
}
}
</script> |
_______________________________________ mfg Thomas Mell
www.validome.org
|
|
| 14.11.2007 16:38:25 |
|
Wechsel zu
Die letzten Beiträge aus diesen Forum
|
|