I have a problem, with disabling a input button with javascript in a aspx document at ie.
The js look’s like
<script language="javascript" type="text/javascript">
function SetButtonStatus(sender, target)
{
if (searchinput.value.length < 4)
{
document.getElementById(target).disabled = true;
}
else
{
document.getElementById(target).disabled = false;
}
}
</script>
I call the input button with
<input name="searchinput" type="text" value="" id="searchinput" onkeyup="SetButtonStatus(this, 'searchsubmit')" />
In Chrome everything works fine. If i type more then 4 characters in the inputfield, the button will be enabled. But in IE & FF nothing happens… Why? How could i fix this?
You are depending on the non-standard “Create a global variable for every element that has an id” that is supported by Chrome and IE in some rendering modes.
Replace
searchinputwithsender(since you have definedsenderand passed a reference to the element you are interested in already).