DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> JavaScript綜合知識 >> javascript檢查浏覽器是否支持flash的實現代碼
javascript檢查浏覽器是否支持flash的實現代碼
編輯:JavaScript綜合知識     

 

<script> 02   function flashChecker() { 03     var hasFlash = 0; //是否安裝了flash 04     var flashVersion = 0; //flash版本 05     if (document.all) { 06       var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); 07       if (swf) { 08         hasFlash = 1; 09         VSwf = swf.GetVariable("$version"); 10         flashVersion = parseInt(VSwf.split(" ")[1].split(",")[0]); 11       } 12     } else { 13       if (navigator.plugins && navigator.plugins.length > 0) { 14         var swf = navigator.plugins["Shockwave Flash"]; 15         if (swf) { 16           hasFlash = 1; 17           var words = swf.description.split(" "); 18           for (var i = 0; i < words.length; ++i) { 19             if (isNaN(parseInt(words[i]))) continue; 20             flashVersion = parseInt(words[i]); 21           } 22         } 23       } 24     } 25     return { f: hasFlash, v: flashVersion }; 26   } 27   var fls = flashChecker(); 28   var s = ""; 29   if (fls.f) document.write("您安裝了flash,當前flash版本為: " + fls.v + ".x"); 30   else document.write("您沒有安裝flash");  31 </script>
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved