Hello I've got a question about a script I wrote.
this script contains a form with 2 fields, the 1ste
field encrypts the woord thats filled in. The second field
counts the word. aeoiu is 1 point qx is 5 points and the rest is three points (like scrabble).
The script is almost good. but He gives undentified for the second field. I guess that comes because in the beginning there is a document.write and thats why the last document.write can't be read. Because the form is already closed ( ... )
Any idears ?
thanx hope to hear from one of you soon
this is the code:
function VERSLEUTELEN()
{
var WAAR = true;
var WOORD1;
var TELLER = 0;
var CODE;
var UITVOER;
var UITVOER2;
var WOORD2;
var KLLETTERS;
var punt1K = "aeiou";
var punt5K = "qx";
var TELLER2 = 0;
var WAARDE = 0;
var WAARDE2;
while(WAAR==true)
{
WOORD1 = document.forms[0].elements[0].value;
WOORD2 = document.forms[0].elements[1].value;
if(WOORD1=="")
{
alert("Veld Woord 1 is niet ingevuld.");return false;
} else {
if(WOORD2=="")
{
alert("Veld Woord 2 is niet ingevuld.");return false;
} else {
while(TELLER<WOORD1.length)
{
CODE = WOORD1.charCodeAt(TELLER);
UITVOER = CODE+TELLER+1;
document.write(String.fromCharCode(UITVOER));
TELLER++
}
KLLETTERS = WOORD2.toLowerCase();
while(TELLER<WOORD2.length)
{
if (punt1K.indexOf(KLLETTERS.charAt(TELLER2)) > -1)
{
WAARDE += 1;
} else {
if (punt5K.indexOf(KLLETTERS.charAt(TELLER2)) > -1)
{
WAARDE += 5;
} else {
WAARDE += 3;
}
}
WAARDE2 = WAARDE;
TELLER2++
}
document.write("<BR>",WAARDE2);
WAAR = false
}
}
}
}
this script contains a form with 2 fields, the 1ste
field encrypts the woord thats filled in. The second field
counts the word. aeoiu is 1 point qx is 5 points and the rest is three points (like scrabble).
The script is almost good. but He gives undentified for the second field. I guess that comes because in the beginning there is a document.write and thats why the last document.write can't be read. Because the form is already closed ( ... )
Any idears ?
thanx hope to hear from one of you soon
this is the code:
function VERSLEUTELEN()
{
var WAAR = true;
var WOORD1;
var TELLER = 0;
var CODE;
var UITVOER;
var UITVOER2;
var WOORD2;
var KLLETTERS;
var punt1K = "aeiou";
var punt5K = "qx";
var TELLER2 = 0;
var WAARDE = 0;
var WAARDE2;
while(WAAR==true)
{
WOORD1 = document.forms[0].elements[0].value;
WOORD2 = document.forms[0].elements[1].value;
if(WOORD1=="")
{
alert("Veld Woord 1 is niet ingevuld.");return false;
} else {
if(WOORD2=="")
{
alert("Veld Woord 2 is niet ingevuld.");return false;
} else {
while(TELLER<WOORD1.length)
{
CODE = WOORD1.charCodeAt(TELLER);
UITVOER = CODE+TELLER+1;
document.write(String.fromCharCode(UITVOER));
TELLER++
}
KLLETTERS = WOORD2.toLowerCase();
while(TELLER<WOORD2.length)
{
if (punt1K.indexOf(KLLETTERS.charAt(TELLER2)) > -1)
{
WAARDE += 1;
} else {
if (punt5K.indexOf(KLLETTERS.charAt(TELLER2)) > -1)
{
WAARDE += 5;
} else {
WAARDE += 3;
}
}
WAARDE2 = WAARDE;
TELLER2++
}
document.write("<BR>",WAARDE2);
WAAR = false
}
}
}
}