请问您使用的浏览器版本是哪个呢?

2026-04-06 10:401阅读0评论SEO基础
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计265个文字,预计阅读时间需要2分钟。

请问您使用的浏览器版本是哪个呢?

1. [代码] [JavaScript]代码示例:!DOCTYPE 匿名函数浏览器检测案例

1.[代码][JavaScript]代码

<!doctype html> <html> <head> <meta charset="utf-8"> <title>匿名函数浏览器检测案例</title> </head> <body> <script> function showTable(){ var r=2; if(window.ActiveXObject){ //判断是否为ie浏览器 window.ActiveXObject为真 则是ie浏览器 r=1; } if(r==1){ showTable=function(){ //ie用table var arr=arguments[0]; document.write("<table border='1' width='800px'>"); for(var i=0;i<arr.length;i++){ document.write("<tr>"); document.write("<td>"+arr[i].name+"</td><td>"+arr[i].age+"</td>"); document.write("</tr>"); } } }else if(r==2){ showTable=function(){ //ff用ul var arr=arguments[0]; document.write("<ul>"); for(var i=0;i<arr.length;i++){ document.write("<li>"); document.write(arr[i].name+" "+arr[i].age); document.write("</li>"); } document.write("</ul>") } } } function showTree(){ var r=2; if(window.ActiveXObject){ r=1; } if(r==1){ showTree=function(){ document.write("以ie的特性来显示tree<br/>"); } }else if(r==2){ showTree=function(){ document.write("以ff的特性来显示tree<br/>"); } } } (function(){ showTable(); showTree(); })(); var arr=[{name:'smith',age:20},{name:'tom',age:22}]; showTable(arr); </script> </body> </html>

请问您使用的浏览器版本是哪个呢?

本文共计265个文字,预计阅读时间需要2分钟。

请问您使用的浏览器版本是哪个呢?

1. [代码] [JavaScript]代码示例:!DOCTYPE 匿名函数浏览器检测案例

1.[代码][JavaScript]代码

<!doctype html> <html> <head> <meta charset="utf-8"> <title>匿名函数浏览器检测案例</title> </head> <body> <script> function showTable(){ var r=2; if(window.ActiveXObject){ //判断是否为ie浏览器 window.ActiveXObject为真 则是ie浏览器 r=1; } if(r==1){ showTable=function(){ //ie用table var arr=arguments[0]; document.write("<table border='1' width='800px'>"); for(var i=0;i<arr.length;i++){ document.write("<tr>"); document.write("<td>"+arr[i].name+"</td><td>"+arr[i].age+"</td>"); document.write("</tr>"); } } }else if(r==2){ showTable=function(){ //ff用ul var arr=arguments[0]; document.write("<ul>"); for(var i=0;i<arr.length;i++){ document.write("<li>"); document.write(arr[i].name+" "+arr[i].age); document.write("</li>"); } document.write("</ul>") } } } function showTree(){ var r=2; if(window.ActiveXObject){ r=1; } if(r==1){ showTree=function(){ document.write("以ie的特性来显示tree<br/>"); } }else if(r==2){ showTree=function(){ document.write("以ff的特性来显示tree<br/>"); } } } (function(){ showTable(); showTree(); })(); var arr=[{name:'smith',age:20},{name:'tom',age:22}]; showTable(arr); </script> </body> </html>

请问您使用的浏览器版本是哪个呢?