0
所以我有这个网页代码,它在Firefox中工作(有点),但只有选择在IE8中工作。为了使它在Firefox中工作,警报(null
)必须在那里,否则将不会转到href
当myloc == "MySrch"
。我没有收到任何反馈错误,这真是令人困惑。JavaScript功能有时失败onchange
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);
}