Title: Trouble with onchange javascript function
Last modified: August 19, 2016

---

# Trouble with onchange javascript function

 *  [sageleader](https://wordpress.org/support/users/sageleader/)
 * (@sageleader)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/trouble-with-onchange-javascript-function/)
 * I’m having trouble moving my PHP-based site to WordPress. One of the main pages
   I use is a drop down menu of university names, and when you select a school it
   displays a form below to update that school’s information. However, the onchange()
   function is not working. The page calls a javascript file to pull up the data
   as follows:
 *     ```
       function getstatus()
       {
       	var pos = document.getElementById('sform');
       	var value = document.upstatus.sid.options[document.upstatus.sid.selectedIndex].value;
       	pos.innerHTML = 'Loading...';
       	var http = getXMLHTTP();
       	http.open('get', 'http://www.nacurh.org/wordpress/get-status-both/?type=school&sid=' + value);
       	http.onreadystatechange = function()
       	{
       		if (http.readyState == 4 && http.status == 200)
       		{
       			pos.innerHTML = http.responseText;
       		}
       	}
       	http.send(null);
       }
   
       function getystatus()
       {
       	var pos = document.getElementById('sform');
       	var yvalue = document.upstatus.year.options[document.upstatus.year.selectedIndex].value;
       	var value = document.upstatus.sid.options[document.upstatus.sid.selectedIndex].value;
       	pos.innerHTML = 'Loading...';
       	var http = getXMLHTTP();
       	http.open('get', 'http://www.nacurh.org/wordpress/get-status-both/?type=year&sid=' + value + '&year=' + yvalue);
       	http.onreadystatechange = function()
       	{
       		if (http.readyState == 4 && http.status == 200)
       		{
       			pos.innerHTML = http.responseText;
       		}
       	}
       	http.send(null);
       }
       ```
   
 * IE is telling me line 6 character 2 “object expected”. I’m not sure what that
   means. In my <select> tag in wordpress I have it as follows:
 *     ```
       <select name="sid" onchange="getstatus()">
       ```
   
 * HELP!

The topic ‘Trouble with onchange javascript function’ is closed to new replies.

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [onchange](https://wordpress.org/support/topic-tag/onchange/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [sageleader](https://wordpress.org/support/users/sageleader/)
 * Last activity: [16 years, 1 month ago](https://wordpress.org/support/topic/trouble-with-onchange-javascript-function/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
