Input prompt

  • Thread starter Christopher Benson-Manica
  • Start date
C

Christopher Benson-Manica

Is there a way to limit the amount of text a user may type into an input
dialog box (like window.prompt("Enter a 10 character value"))?
 
L

Lee

Christopher Benson-Manica said:
Is there a way to limit the amount of text a user may type into an input
dialog box (like window.prompt("Enter a 10 character value"))?

<html>
<body>
<script type="text/javascript">
var pword="";
var msg="Please enter a 10 character value";
var expletive=", dammit!";
while(pword.length!=10){
pword=prompt(msg);
msg+=expletive;
expletive="";
}
document.write("Thank you for entering \""+pword+"\"");
</script>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top