J
jceddy
Hey, I'm running into something that might strike as a bit odd. I have
a function that is, onchange of a form element, disabling a given form
element and then later re-enabling it...basically this is for some
control while asynchronous processes are happening.
Anyway, I've created the following simple code that I've been playing
around with:
-------
<html>
<head>
<title>Test</title>
<script Language="JavaScript">
function doFocusThing() {
document.the_form.the_select.disabled = true;
document.the_form.the_select.disabled = false;
setTimeout( 'bringFocus();', 1000 );
}
function bringFocus() {
document.the_form.the_text.focus();
//document.the_form.the_select.focus();
}
</script>
</head>
<body>
<form name="the_form">
<select name="the_select" onChange="doFocusThing();">
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select>
<input type="text" name="the_text" />
</form>
</body>
</html>
-------
If you run this in IE, and then select something from the select list,
you'll see the select lost focus (because it was disabled, presumably),
but the text field never gets focus afterward.
Anyone got a good reason why not and maybe even an idea of what I could
do in this case to get focus on this thingie?
Cheers,
Joe
a function that is, onchange of a form element, disabling a given form
element and then later re-enabling it...basically this is for some
control while asynchronous processes are happening.
Anyway, I've created the following simple code that I've been playing
around with:
-------
<html>
<head>
<title>Test</title>
<script Language="JavaScript">
function doFocusThing() {
document.the_form.the_select.disabled = true;
document.the_form.the_select.disabled = false;
setTimeout( 'bringFocus();', 1000 );
}
function bringFocus() {
document.the_form.the_text.focus();
//document.the_form.the_select.focus();
}
</script>
</head>
<body>
<form name="the_form">
<select name="the_select" onChange="doFocusThing();">
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select>
<input type="text" name="the_text" />
</form>
</body>
</html>
-------
If you run this in IE, and then select something from the select list,
you'll see the select lost focus (because it was disabled, presumably),
but the text field never gets focus afterward.
Anyone got a good reason why not and maybe even an idea of what I could
do in this case to get focus on this thingie?
Cheers,
Joe