0

Hey all

Can anyone see why this isn't working for IE but is Firefox? I'm trying to update a div on the page using some javascript and php. Whenever a dropdown box on the html page is changed, its value is passed to a javascript function, then onto a php file. The php file runs and javascript updates the div.

HTML Code:

<html>
<head>
<script type="text/javascript" src="include/js/tournSearch.js"></script>
</head>
<body>
<select id="in_out_door" onchange="updateTourns()">
	<option></option>
	<option>Indoor</option>
	<option>Outdoor</option>
	<option>Sand</option>
</select>
<div id="tourn"></div>
</body>
</html>

Javascript Code:

var xmlhttp;

function updateTourns() {
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url = "include/js/tournSearch.php";
	url = url + "?in_out_door1=" + document.getElementById('in_out_door').value;
	url = url + "&class1=" + document.getElementById('class').value;
	url = url + "&region1=" + document.getElementById('region').value;
	url = url + "&level1=" + document.getElementById('level').value;
	url = url + "&year1=" + document.getElementById('year').value;
	url = url + "&sid=" + Math.random();
	xmlhttp.onreadystatechange=stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
	
function stateChanged()	{
	if (xmlhttp.readyState==4)
		document.getElementById("tourn").innerHTML=xmlhttp.responseText;
}
	
function GetXmlHttpObject()	{
	if (window.XMLHttpRequest)
		return new XMLHttpRequest();	// code for IE7+, Firefox, Chrome, Opera, Safari
	if (window.ActiveXObject)
		return new ActiveXObject("Microsoft.XMLHTTP");	// code for IE6, IE5
	return null;
}

Finally, tournSearch.php

$in_out_door = $_GET['in_out_door1'];
$class = $_GET['class1'];
$region = $_GET['region1'];
$level = $_GET['level1'];
$year = $_GET['year1'];
echo $in_out_door . ", " . $class . ", ";

In Firefox whatever was selected from the dropdown box is echo'd. This does not happen in IE.

Thank you!

Edited by benrich: n/a

1
Contributor
1
Reply
2
Views
8 Years
Discussion Span
Last Post by benrich
0

Not to worry. After much more google searches it appears IE requires value attributes in the select tags

<select id="in_out_door" onchange="updateTourns()">
	<option></option>
	<option value="Indoor">Indoor</option>
	<option value="Outdoor">Outdoor</option>
	<option value="Sand">Sand</option>
</select>

Awesome

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.