...

View Full Version : Running a function from Listbox 'onchange'



Gyto
10-12-2006, 11:22 AM
Hi there, this seems extremely simple but for some reason I can't see the problem with it.....maybe a fresh pair of eyes will help! I have the following javascript function and listbox:



<script type="text/javascript">
function IntOrExt()
{
if (document.FormName.IntOrExt.Value == "Int")
{
document.FormName.SecondaryExtRangeFrom.disabled=false;
document.FormName.SecondaryExtRangeTo.disabled=false;
}
else
{
document.FormName.SecondaryExtRangeFrom.disabled=true;
document.FormName.SecondaryExtRangeTo.disabled=true;
}
}
</script>



<select name="IntOrExt" id="IntOrExt" style="width:188px" onchange="IntOrExt()">

<option selected="selected" value="Ext">External Numbers</option>
<option value="Int">Internal Number Range</option>

</select>


When I change the value of the listbox I get the error:

"Error: Object doesn't support this property or method"

Any ideas why?!

Thanks

Gyto
10-12-2006, 01:51 PM
ah.....I've done it now......I used the following code instead:



<script type="text/javascript">

function setIntOrExt(val)
{
if (val == "Int")
{
document.FormName.SecondaryExtRangeFrom.disabled=false;
document.FormName.SecondaryExtRangeTo.disabled=false;
}
else
{
document.FormName.SecondaryExtRangeFrom.disabled=true;
document.FormName.SecondaryExtRangeTo.disabled=true;
}
}
</script>


<select name="IntOrExt" id="IntOrExt" style="width:188px" onchange="setIntOrExt(this.value);">
<option selected="selected" value="Ext">External Numbers</option>
<option value="Int">Internal Number Range</option>
</select>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum