Forum Moderators: open
does this help...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><script type="text/javascript">
window.onload=function() {
document.forms[0][0].focus();
}
</script></head>
<body><form action="#">
<div>
<input type="text"/>
</div>
</form></body>
</html>
birdbrain
I am not quite sure what you mean.
Do you have four forms on one page or one form on four pages.
Would it be possible to see some relevant code?
birdbrain
<form action="form2.php" method="post">
<input type="hidden" name="usid" value="usid">
<input type="text" name="answer" value="">
</form>
<form action="form3.php" method="post">
<input type="hidden" name="usid" value="usid">
<input type="text" name="answer" value="">
</form>
<form action="form4.php" method="post">
<input type="hidden" name="usid" value="usid">
<input type="text" name="answer" value="">
</form>
I'd like the cursor to be in place ready for the user to start typing, rather than click in the box and then start typing. The code you gave me above worked for the first form but not the others. Has this made it clearer?
Derek
You can, of course, only have focus on one element at a time.
This example will change focus to the next element onblur of the previous...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><script type="text/javascript">
var df=document.forms;
window.onload=function() {
df[0][1].focus();df[0][1].onblur=function() {
df[1][1].focus();
}
df[1][1].onblur=function() {
df[2][1].focus();
}
df[2][1].onblur=function() {
df[3][1].focus();
}
}
</script></head>
<body><form action="form1.php" method="post">
<input type="hidden" name="usid" value="usid">
<input type="text" name="answer" value="">
</form><form action="form2.php" method="post">
<input type="hidden" name="usid" value="usid">
<input type="text" name="answer" value="">
</form><form action="form3.php" method="post">
<input type="hidden" name="usid" value="usid">
<input type="text" name="answer" value="">
</form><form action="form4.php" method="post">
<input type="hidden" name="usid" value="usid">
<input type="text" name="answer" value="">
</form></body>
</html>
birdbrain
No problem, you're very welcome. ;)