|
How to make text appear after the prompt.
Hello All,
I have made a prompt and marked it in bold below. I would like text to appear after what the person has entered
At current it reads Hello (Name Prompt)
I would like it to appear saying something on the lines of Hello (Name Prompt) Enjoy The Game.
Any Ideas?
<html>
<body>
<SCRIPT LANGUAGE="JavaScript">
<head>
<TITLE>Find the Correct Number Game</TITLE>
</head>
a=(prompt('please enter your name:',0)); // prompt for player name
document.write(' Hello ' ,a);
var guessme=Math.round(Math.random()*(49)+1);
var speech='Choose a number between 1 and 50';
function process(hiddennumber) {
var guessnumber=document.forms.guesstable.guessnumber.value;
var speech='"'+guessnumber+ '" Letters are not allowed. Please enter digits only!.';
document.forms.guesstable.guessnumber.value='';
if (guessnumber==hiddennumber)
{
document.forms.guesstable.prompt.value='Congratulations! '+hiddennumber+' is correct!';
alert ('Well done - the mystery number is '+hiddennumber+'! \n\nIf you want to play again click the button.');
speech='';
document.location=document.location;
}
if (hiddennumber<guessnumber)
{
speech='Less than '+ guessnumber;
}
if (hiddennumber>guessnumber)
{
speech='Greater than '+ guessnumber;
}
if (guessnumber=='')
{
speech='You didn\'t guess anything!'
}
document.forms.guesstable.prompt.value=speech; document.forms.guesstable.guessnumber.focus();
}
</SCRIPT>
</body>
</html>
<FORM onSubmit="" NAME="guesstable">
<CENTER>
<TABLE ALIGN="left" BGCOLOR="#888889" BORDER="5" CELLPADDING="5">
<TR>
<TD BGCOLOR="#004081">
<FONT COLOR="#ffffff" FACE="Arial"><B>Find the Correct Number</B></FONT>
</TD>
</TR>
<TR>
<TD>
<CENTER>
<INPUT TYPE="text" NAME="prompt" SIZE="31" MAXLENGTH="60" VALUE="Find the correct number which is between 1 and 50"><BR>
<INPUT TYPE="text" NAME="guessnumber" SIZE="3" MAXLENGTH="3" VALUE="">
<INPUT TYPE="button" VALUE="Enter" onClick='process(guessme)'>
</CENTER>
</TD>
</TR>
</TABLE>
</CENTER>
</FORM>
|