标题 | javascript检查浏览器是否支持flash的实现代码 |
内容 | javascript检查浏览器是否支持flash,程序输出结果: view sourceprint?01 <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> |
随便看 |
|
在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。