I have made working validation of form: [url]www.itssimple.pl/1.html[/url] And then I’ve tried to make the same validation but in form witch radios. And my problem is that it isn’t working at all. Have a look: [url]www.itssimple.pl/5.html[/url]
@heldanauthorAug 24.2010 — #I know how does the for works, but I dont know how to get throught all radios and validate answers if I can not name them the same way.
Look into my code, and you will know, what i want to do.
@FangAug 25.2010 — #Incorrect referencing of elements and arrays [CODE]function validate() { errfound = false; var odp = new Array(0,0,1,1,2,2,3,3,0,0); // arry numbering starts at 0 not 1 var odpa = new Array("A","A","B","B","C","C","D","D","A","A");
var brak = "<img src="x.jpg"> <span style="color:red">Brak odpowiedzi,</span><span style="color:green"> poprawnie:</span> "; var lub = " lub "; var br = "<br/>"; var bledy = ""; var poprawnie = "<img src="x.jpg"><span style="color:red">¬le,</span> <span style="color:green">poprawnie:</span> "; var blad = new Array(); var punkty = 0;
var no = ['no1', 'no2', 'no3', 'no4', 'no5', 'no6', 'no7', 'no8', 'no9', 'no10']; for(var j=0;sel=document.getElementsByName(no[j]), j<sel.length; j++) {