#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2010
    Posts
    46
    Rep Power
    10

    OnChange not working


    I having trouble getting onChange() to fire.

    this is where I'm calling it
    Code:
    <select name="location" id="select-location onChange="changeSecond(this.value)">
    for this code
    Code:
    function changeSecond(first){
    	alert('dasda');
    	var xmlhttp;
    	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
    		xmlhttp=new XMLHttpRequest();
    	} else {// code for IE6, IE5
    		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    	}
    	xmlhttp.onreadystatechange=function(){
    		if (xmlhttp.readyState==4 && xmlhttp.status==200){
    			var res=xmlhttp.responseText;
    			document.getElementById("second").innerHTML=res;
    		}
    	}
    	xmlhttp.open("GET","reservations-plane.php?first="+first,true);
    	xmlhttp.send();
    }
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2010
    Posts
    46
    Rep Power
    10
    Got it working I didn't have the closing " on the id.

    Comments on this post

    • Kravvitz agrees : Congrats on finding the solution and thanks for posting it.

IMN logo majestic logo threadwatch logo seochat tools logo