2008-03-18 Some Javascript functions of ClickOnce's publish.htm 54181 0 AJAX 2008-03-23 Some Javascript functions of ClickOnce's publish.htm 隱藏必須條件區塊 偵測使用者 .NET Framework CLR 版本 比較 CLR 版本 <script type="text/javascript"> function Initialize( ) { var runtimeVersion = "3.5.0"; var directLink = "InformationBoard5.application"; var setupLink = "setup.exe"; BootstrapperSection.style.display = "none"; // 3.5 Version if (HasRuntimeVersion(runtimeVersion) ) { InstallButton.href = directLink; } // NOT 3.5 Version else { InstallButton.href = setupLink; } } function HasRuntimeVersion(v) { var va = GetVersion(v); var i; var a = navigator.userAgent.match ( /\.NET CLR [ 0 -9.]+/g ); if (a != null ) for (i = 0; i < a.length; ++i) if (CompareVersions(va, GetVersion(a[i] ) ) <= 0 ) return true; return false; } function GetVersion(v) { var a = v.match ( /( [ 0 -9 ]+)\. ( [ 0 -9 ]+)\. ( [ 0 -9 ]+)/i ); return a.slice ( 1 ); } function CompareVersions(v1, v2) { for (i = 0; i < v1.length; ++i) { var n1 = new Number(v1[i] ); var n2 = new Number(v2[i] ); if (n1 < n2) return -1; if (n1 > n2) return 1; } return 0; } </script> ASP.NETchhuangAJAXWindowForm 回首頁