I’ve been developing a web site for months now. I am working in IIS. The site is all being developed and served on a single machine (it will be distributed among servers later).
The piece of code below works if I use local host in the URL thus –
http://localhost/TEST/selectTest.aspx
It does not work if I use the machine name –
http://MyMachine/TEST/selectTest.aspx
The alert still pops, but it’s blank if I use the MyMachine name in the URL. It’s fine if I use local host and returns the correct info in the alert.
There are thousands of lines of code in this project that work just fine using the machine name. The only thing that fails is the HTML <select> tag. Any ideas?
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="selectTest.aspx.vb" Inherits="selectTest" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function testSelect(selected) {
alert(selected);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<select id="Select2" onchange = 'testSelect(this.options[this.selectedIndex].value)'>
<option selected="selected">
Select Layer for ID
</option>
<option>
Parcels
</option>
<option>
Zoning
</option>
</select>
</div>
</form>
</body>
</html>