Jump to content

Javascript script working in FireFox but not IE


Tanis

Recommended Posts

Hey guys, I've got a script where you select what you want displayed from a drop down menu, and, obviously, what you select is what displays.

 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" ><link rel="stylesheet" type="text/css" href="sddm.css" ><script language="JavaScript" type="text/javascript">		<!--;			var page_url = "";			function makeObject() {			var x;			var browser = navigator.appName;				if (browser == "Microsoft Internet Explorer") {				x = new ActiveXObject("Microsoft.XMLHTTP");				}				else {				x = new XMLHttpRequest();				}			return x;			}			var request = makeObject();			function open_page() {			request.open("get", ""+document.forms['selectForm'].selection.value+"");			request.onreadystatechange = parseInfo;			request.send('');			}			function parseInfo() {				if (request.readyState == 1) {				document.getElementById("myDiv").innerHTML = "Loading...";				}				if (request.readyState == 4) {				var answer = request.responseText;				document.getElementById("myDiv").innerHTML = answer;				}			}		//-->		</script></head><b><center><font color=#C7C7C7><br><br><img src="/divide.jpg"><br><br><table style="width:100%;">			<tr>				<td width="15%"><center>Please select what to show:					<form action="" method="" name="selectForm">						<input type="hidden" name="selection" value="" />						<select name="changeDiv">							<option onclick="java script:document.forms['selectForm'].selection.value='HC.php';">Habbo Club</option>							<option onclick="java script:document.forms['selectForm'].selection.value='regular.php';">Regular Rares</option>							<option onclick="java script:document.forms['selectForm'].selection.value='super.php';">Super Rares</option>							<option onclick="java script:document.forms['selectForm'].selection.value='vday.php';">Valentine's Day</option>							<option onclick="java script:document.forms['selectForm'].selection.value='easter.php';">Easter</option>							<option onclick="java script:document.forms['selectForm'].selection.value='habboween.php';">Habboween</option>							<option onclick="java script:document.forms['selectForm'].selection.value='xmas.php';">Christmas</option>							<option onclick="java script:document.forms['selectForm'].selection.value='sports.php';">Sports</option>							<option onclick="java script:document.forms['selectForm'].selection.value='bathroom.php';">Bathroom</option>							<option onclick="java script:document.forms['selectForm'].selection.value='fengshui.php';">Feng Shui</option>						</select>						<input type="button" onclick="java script:open_page();" value="Go" />					</form>				</td>			</tr></table></b><br><br><br><table border="0" width="580">	<tr>		<td width="25">    </td>		<td width="197"><center><img src="Furni/hcsofa.gif">			<b><font size="2"><br>HC Sofa</b><br>HC Sofas- 1<br>			Ducks- 50</font></center>	  </td>		<td width="70">    </td>		<td width="176"><center><img src="Furni/duck.gif">			<b><font size="2"><br>		  Duck</b><br>HC Sofas- 0.02<br>	  Coins- 1</font></td><td width="82"></center>		<td width="4"></td>	</tr>	 	<tr>		<td> <br> <br> </td>	</tr>	</table>			<div id="myDiv">		</div> </center>

Can anyone help me?

Link to comment
Share on other sites

Tanis,Change your Option lines to read as follows

<option value='HC.php'>Habbo Club</option>

Also, add this id to your select line.

<select name="changeDiv" id="changeDiv">

In the function open_page, change

request.open("get", ""+document.forms['selectForm'].selection.value+"");

to

request.open("get", document.getElementById("changeDiv").options[document.getElementById("changeDiv").selectedIndex].value,true);

When you click the "Go" button, the open_page function will get the value of the selected option and use it as the URL for the page you want to retrieve.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...