Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2006
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Running a function from Listbox 'onchange'

    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:

    Code:
    <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

  • #2
    New Coder
    Join Date
    Oct 2006
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ah.....I've done it now......I used the following code instead:

    Code:
    <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>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •