获取服务器端控件,检测服务器版本
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>改变Select控件选中项背景色</title> <script type="text/javascript"> function A() { var oBt = document.getElementById("<%=Button1.ClientID%>"); oBt.disabled = true; //相当于Button1.Enabled = true; //oBt.disabled = false; //相当于Button1.Enabled = false; } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:Button ID="Button1" runat="server" OnClientClick="A()" Text="提交" /> </div> </form> </body> </html><script type="text/javascript">
function check(reg) { var ug = navigator.userAgent.toLowerCase(); return reg.test(ug); } function checkBrowser() { var ug = navigator.userAgent.toLowerCase(); var userAgent = document.getElementById("userAgent"); userAgent.innerHTML = "浏览器的用户代理报头:" + ug; var browserType = ""; var ver = ""; //检测IE及版本 var IE = ug.match(/msie\s*\d\.\d/); //提取浏览器类型及版本信息,注match()方法返回的是数组而不是字符串 var isIE = check(/msie/); if(isIE) { browserType = "Internet Explorer"; ver = IE.join(" ").match(/[0-9]/g).join("."); //先用join()方法转化为字符串,然后用match()方法匹配到版本信息,再用join()方法转化为字符串 } //检测chrome及版本 var chrome = ug.match(/chrome\/\d\.\d/gi); var isChrome = check(/chrome/); if(isChrome) { browserType = "Chrome"; ver = chrome.join(" ").match(/[0-9]/g).join("."); } //检测firefox及版本 var firefox = ug.match(/firefox\/\d\.\d/gi); var isFirefox = check(/firefox/); if(isFirefox) { browserType = "Firefox"; ver = firefox.join(" ").match(/[0-9]/g).join("."); } var browser = document.getElementById("browser"); browser.innerHTML = "您正在使用的浏览器为:" + browserType + "<span style='padding-left:15px;'>版本为:</span>" + ver; } </script>
相关推荐
zrtlin 2020-11-09
xuebingnan 2020-11-05
wikiwater 2020-10-27
heheeheh 2020-10-19
Crazyshark 2020-09-15
softwear 2020-08-21
ZGCdemo 2020-08-16
jczwilliam 2020-08-16
littleFatty 2020-08-16
idning 2020-08-03
jinxiutong 2020-07-26
lanzhusiyu 2020-07-19
Skyline 2020-07-04
xiaofanguan 2020-06-25
Aveiox 2020-06-23
dragonzht 2020-06-17