S
Steve
<script language="javascript">
function setMyFocus()
{
if (document.getElementById("price").value == "xyz")
{
document.getElementById("price2").focus();
document.getElementById("price2").select();
}
}
</script>
Price <input type="text" id="price" value="xyz"
Price2 <input type="text" id="price2" value="abc"><br/>
-------------------------------------
This script does exactly what it looks like - when leaving the Price
input field, if the value is xyz, set the focus to the Price2 input
field and selects the text.
However - if I change the focus and select targets in the js portion
from price2 to price, it doesn't work. Control goes to the Desc
field.
I simply can't see what I've got wrong here. Surely this has been
done with form validation millions of times - where am I falling down?
(FF2.0.0.12, WinXP)
TIA -
- Steve
function setMyFocus()
{
if (document.getElementById("price").value == "xyz")
{
document.getElementById("price2").focus();
document.getElementById("price2").select();
}
}
</script>
Price <input type="text" id="price" value="xyz"
Price2 <input type="text" id="price2" value="abc"><br/>
-------------------------------------
This script does exactly what it looks like - when leaving the Price
input field, if the value is xyz, set the focus to the Price2 input
field and selects the text.
However - if I change the focus and select targets in the js portion
from price2 to price, it doesn't work. Control goes to the Desc
field.
I simply can't see what I've got wrong here. Surely this has been
done with form validation millions of times - where am I falling down?
(FF2.0.0.12, WinXP)
TIA -
- Steve