Results 1 to 2 of 2

Thread: form change font color within span when numer match is true

  1. #1
    Join Date
    Jun 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default form change font color within span when numer match is true

    Hello all, I'm totally new to this forum, My name is Chris from the Netherlands. 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.



  2. #2
    Join Date
    Jun 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Can anyone help me?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •