I'm trying to lern javascript, but my knowledge doesn't cover what I want, so I could really use some help. I'm trying to make a lotto check form for our family. Can somebody explain me how to alter this code to color the font green even if the match isn't on the same place, please take a look at this image, it explains more then 1000 words. Here is an example, don't mind the banner, it's a family joke, so nothing commercial. it only works in IE at the moment. http://www.coldcharlie.nl/lotto.html Code: <SCRIPT TYPE="TEXT/JAVASCRIPT"> // Check lotto function checkLotto() { var goed = frmTrekking.Getal var fout = frmGetallen.Opgegeven for (var z0=0;z0<goed.length;z0++){ if (goed[z0]&&fout[z0]){ if (goed[z0].value==fout[z0].value){ fout[z0].parentNode.style.color='#00FF00'; fout[z0].parentNode.getElementsByTagName('SPAN')[0].innerHTML+=goed[z0].value; } else { fout[z0].parentNode.style.color='#cc0000'; fout[z0].parentNode.getElementsByTagName('SPAN')[0].innerHTML+=fout[z0].value; } } } } </script> Beneath is a graphical explaination, I really hopes this helps. I'l make you a free logo when it's working
You could use the String Object Syntax.... Code: stringObject.fontcolor(color) Such as: Code: var str="Change Me!"; document.write(str.fontcolor("Red"));