<script type="text/javascript">
var browser=navigator.appName
var b_version=navigator.appVersion
var version=b_version.split(";");
var trim_Version=version[1].replace(/[ ]/g,"");
if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE7.0")
{
alert("IE 7.0");
}
else if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0")
{
alert("IE 6.0");
}
</script>
下面是我寫的一個經典例子
<div id="sitetips" style="display: block">
<table align="center" cellpadding="0" cellspacing="0" style="height:30px;">
<tr>
<td align="center" valign="middle">
<script language="javascript">
document.write("<span>您正在使用Internet Explorer 6,在本站頁面的顯示效果可能有差異。建議您升級到<a href='http://www.microsoft.com/china/windows/internet-explorer/' target='_blank'>Internet Explorer 8</a> </span>");
</script>
</td>
</tr>
</table>
</div>
<script> if (Fai.isIE7() || Fai.isIE6()) { document.getElementById('sitetips').style.display='block'; } </script>