Berechnung aller inputs

Fals ihr wissen wollt welcher Radio Button vorm Wechseln geklickt wahr. Vielleicht hilf euch das weiter

Der hier verwendete Code

<form name="myForm"> 1<input type="radio" name="radios" value="1" /><br> 2<input type="radio" name="radios" value="2" /><br> 3 <input type="radio" name="radios" value="3" /> <br> 4 <input type="radio" name="radios" value="4" /><br> <div id="aus"></div> </form> <script> var radi = document.myForm.radios; var prev = null; for(var i = 0; i < radi.length; i++) { radi[i].onclick = function() { a=(prev)? (prev.value):null if(this !== prev) { prev = this; } document.getElementById('aus').innerHTML='Von '+a+'<br>Zu '+this.value; }; } </script>

Add Comment

* Required information
1000
Drag & drop images (max 3)
Powered by Commentics

Comments

No comments yet. Be the first!