The script I'm using is like the following one. It has to work in IE. Other
browsers are not important for now, because it's meant as a field check for
a business application.
When you use the buttons to set focus to the appropriate field the function
used to setfocus works perfectly.
When the NotEmpty function is triggered by leaving the input field the focus
stays on the next selected field.
When you want to see this code working visit :
http://home.zonnet.nl/janwouter/script/focus.html
<html>
<head>
<script lang=javascript >
function NotEmpty(veld)
{
TestOk="N";
invoer=veld.val ue.toString();
for(var i=0;i<invoer.le ngth;i++)
{
var teken =invoer.charAt( i);
if (teken != ' ')
{
TestOk="J";
i=invoer.length ;
}
}
if (TestOk=="N")
{
/* alert('Veld mag niet leeg zijn');*/
veld.value="Fie ld may not be empty !!";
focusonfield(ve ld);
}
} /*einde functie NotEmpty*/
function focusonfield(fi eld)
{
if (field.name=="i np1")
{document.form1 .inp1.focus()}
if (field.name=="i np2")
{document.form1 .inp2.focus()}
if (field.name=="i np3")
{document.form1 .inp3.focus()}
}
</script>
</head>
<body>
<form name ="form1">
<input name="inp1" value="veld1" onchange="NotEm pty(this)";/>
<input name="inp2" value="veld2" onchange="NotEm pty(this)";/>
<input name="inp3" value="veld3" onchange="NotEm pty(this)";/>
<br/>
<button name="but1" onclick="focuso nfield(form1.in p1)">veld1</button>
<button name="but2" onclick="focuso nfield(form1.in p2)">veld2</button>
<button name="but3" onclick="focuso nfield(form1.in p3)">veld3</button>
</form>
</body>
"Stuart Palmer" <tr**********@y oucant.com> schreef in bericht
news:2j******** *****@uni-berlin.de...
Can you supply your full code? (JS and forms html), what browsers are you
using too?
Stu