[Javascript] (no subject)

Robert Kidd clowns at gol.com
Sun Apr 22 12:30:25 CDT 2001


I am new to JavaScript and I have been reading the books but I can't seem to solve this little problem. I would like to open a new popup window when the student finishes the task and clicks "OK" on an alert message. Depending on the message there are several windows which could open. The tasks are to figure out a phrasal verb in a given time limit and the popups would have the definition and some sample sentences. My question is how can I trigger the specific popup for the phrase the student has just completed.

The following is what I have so far achieved after several hours of trial and error. I can get it to open a page but my problem is I don't know how to reference the phrases so that I can open the specific page with the definition of the phrase the student was working on.

function letter(l)
 { a=l.value.substring(1,2); l.value="   "; dh=document.verbs;
   if (a!=" ")
    { w=dh.word.value;
      b=w.indexOf(a,0); f=1; dhl=dh.left;
      while (b>-1)
       { dh.elements[b+27].value=a;
         b=w.indexOf(a,b+1); f=0; ltc--; };
      dhl.value-=f;
      if (dhl.value==0)
       for (j=0;j<26;j++)
        dh.elements[j+1].click();
    }; };
function count()
 { dh=document.verbs; dhc=dh.clock; dhl=dh.left;
   dhc.value-=1; v=dhl.value*ltc*dhc.value
   if (v>0)
    setTimeout("count();",1000);
   else
    { msg="THAT'S GREAT! TRY AGAIN?";parent.location.href="http://www.english-zoo.com/englishf/games/phrasalv/answers.html"
      if (dhl.value<0)
       msg="SORRY, THAT'S TOO MANY GUESSES!";parent.location.href="http://www.english-zoo.com/englishf/games/phrasalv/answers.html"
      if (ltc>0)
       msg="TIME'S UP! Answer:\n"+dh.word.value;parent.location.href="http://www.english-zoo.com/englishf/games/phrasalv/answers.html"
      dhl.value="0";
      alert(msg);
    }; };
</script>

Is this the best way or could someone suggest a cleaner way to do it? Any help at all would be appreciated. Sorry if this is too elementary for this list.

Robert Kidd





More information about the Javascript mailing list