所以我有这个网页代码,它在 Firefox 中工作(有点),但只有选择在 IE8 中工作。为了让它在 Firefox 中正常工作,alert( null
) 必须在那里,否则它不会href
在myloc == "MySrch"
. 我没有收到任何反馈错误,这真的很令人困惑。
SqlStr = "Select DISTINCT Unit From Employee Where PhoneBook = 1 Order by Unit;"
Set UniNme = Connection.Execute(SqlStr)
Response.Write "<select id='Unit' onChange='Change(this.id)'>"
Response.Write "<option value=''>Choose Unit</option><br>"
Response.Write "<option value='Everyone'>Everyone</option><br>"
Do While Not UniNme.EOF
Response.Write "<option value='"&UniNme("Unit")&"'>"&UniNme("Unit")&"</option><br>"
UniNme.MoveNext
Loop
Response.Write "</select><br>"
Response.Write "Name Search: <input type='text' id='MySrch' onChange='Change(this.id)'>"
javascript函数是
function Change(myloc) {
if (myloc == "Unit") {
var myindex = document.getElementById(myloc).selectedIndex;
myvalue = document.getElementsByTagName("option")[myindex].value;
} else {
var myvalue = document.getElementById(myloc).value;
}
document.cookie = "Temp1="+escape(myloc);
document.cookie = "Temp2="+escape(myvalue);
document.location.href="AEmployees.asp?action=Change";
alert(null);
}