|
-
Mar 13th, 2002, 12:50 PM
#1
Thread Starter
Hyperactive Member
Two questions. 1. Reg'd Prompt Box. 2. Reg'd Auto Tab script.
Hi,
1. Is there any way to get a prompt box to show up in the middle of the screen rather than the top-left?
2. I'm looking for some code that will move to the next text box when 2 characters are entered in the current box.
Thanks,
Al.
A computer is a tool, not a toy.
-
Mar 13th, 2002, 05:15 PM
#2
Addicted Member
For centering, try:
<form>
<br><br><br><br><br><br><br><br>
<center><input name="prompt_box"></center>
</form>
For auto-tabbing you would use JavaScript and you would add an
onChange="tabFunction(this)" to your input field, i.e.:
<input name="prompt_box" onChange="tabFunction(this)">
Then you would set up the tabFunction(string) to check to see if string.length is greater than 2 and if so, tab to the next field.
cudabean
-
Mar 14th, 2002, 08:30 AM
#3
Thread Starter
Hyperactive Member
Thanks for the reply. I was able to get the tab function to work.
The prompt box is a JavaScript prompt. e.g.
Code:
function EnterPrice(){
Price=prompt("Item 12345 is not in the price file. Please enter your price.");
....
}
It's this prompt box I'm trying to center on the screen.
Thanks,
Al.
A computer is a tool, not a toy.
-
Mar 14th, 2002, 08:45 AM
#4
Fanatic Member
1/ Dont think its possible, it just pops up where it wants too. I'd use a <input type="text"> instead
2/ Try This...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Set Focus After Length Of Characters Has Exceeded</title>
<script language="JavaScript" type="text/javascript">
<!--
// objectID is ID of element
// activateID is ID of element you want to give focus too
// maximum is the maximum length before activateID gets focus
function checkLength(objectID,activateID,maximum){
if (document.getElementById(objectID).value.length==maximum){
document.getElementById(activateID).focus();
}
}
//-->
</script>
</head>
<body>
<form name="form1">
<input type="text" name="text1" id="text1" onkeypress="checkLength('text1','text2',2)">
<input type="text" name="text2" id="text2" onkeypress="checkLength('text2','text3',2)">
<input type="text" name="text3" id="text3">
</form>
</body>
</html>
Hope this helps
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|