您的Response.Write
声明(大小写不正确)应该在<% %>
标签内。您的代码中似乎也有 C# 和VB.NET的奇怪混合。您正在使用以下哪个?
C#
document.getElementById(name).style.display =
<% if (Request.ServerVariables["HTTP_USER_AGENT"].Contains("FireFox"))
Response.Write("'table-row'");
else
Response.Write("'block'"); %>; // Semi-colon outside of %> is for JavaScript
VB.NET
document.getElementById(name).style.display =
<% If (Request.ServerVariables("HTTP_USER_AGENT").Contains("FireFox")) Then
Response.Write("'table-row'")
Else
Response.Write("'block'")
End If %>; // Semi-colon outside of %> is for JavaScript