dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: wordvalue - scrabble style

  1. #1
    Join Date
    Jan 2003
    Posts
    14

    wordvalue - scrabble style

    Hey, I was working on a little javascript for my website and I tried some word games. I created a word encrypter, and it works fine. Now I'm working on a script that shows the wordvalue of any entered word, much like the game scrabble. However, my script keeps buggin me with the error that one or more variables aren't defined. The variables mentioned are just a few lines higher, so they are defined. Can anyone tell me what's wrong. I'll attach the entire script and I'll paste the part with the problem.

    Oh yeah, and I'm from the netherlands, so some pieces are in dutch.

    function woordWaarde()
    {
    var woordwaardeReeks = document.forms[0].elements[1].value;
    var tekst = woordwaardeReeks.toLowerCase();
    var waardeKL = 0;
    var zoekKL = woordwaardeReeks.match(/[aeiouy]/gi);
    var waardeMKL = 0;
    var zoekMKL = woordwaardeReeks.match(/[bcdfghjklmnprstvwz]/gi);
    var waardeS = 0;
    var zoekS = woordwaardeReeks.match(/[xq]/gi);

    if (zoekKL)
    {
    for(var l = 0; l < zoekKL.length; l++)
    waardeKL = 1 * zoekKL.length;
    } else {
    if (zoekMKL)
    {
    for(var l = 0; l < zoekMKL.length; l++)
    waardeMKL = 3 * zoekMKL.length;
    } else {
    if (zoekS)
    {
    for(var l = 0; l < zoekS.length; l++)
    waardeS = 5 * zoekS.length;
    }
    }
    }
    }
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2003
    Posts
    14
    You are not going to belive this.....

    I solved the problem, I tried to read a variable wich I declared in a function. Guess what? I tried reading it OUTSIDE the function.

    Guess you can't program for several hours straight and still think normal.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles