JavaScript 判断浏览器类型及版本
$(document).ready(function() {
var Sys = {};
var ua = navigator.userAgent.toLowerCase();
if (window.ActiveXObject)
Sys.ie = ua.match(/msie ([\d.]+)/)[1]
else if (document.getBoxObjectFor)
Sys.firefox = ua.match(/firefox\/([\d.]+)/)[1]
else if (window.MessageEvent && !document.getBoxObjectFor)
Sys.chrome = ua.match(/chrome\/([\d.]+)/)[1]
else if (window.opera)
Sys.opera = ua.match(/opera.([\d.]+)/)[1]
else if (window.openDatabase)
Sys.safari = ua.match(/version\/([\d.]+)/)[1];
//以下进行测试
if (Sys.ie) $("#llq").html("IE:" + Sys.ie);
if (Sys.firefox) $("#llq").html("Firefox: " + Sys.firefox);
if (Sys.chrome) $("#llq").html('Chrome: ' + Sys.chrome);
if (Sys.opera) $("#llq").html('Opera: ' + Sys.opera);
if (Sys.safari) $("#llq").html('Safari: ' + Sys.safari);
})
相关文档:
<html>
<head>
<mce:style><!--
.tvline{width:240px;height:180px;border:0;}
.tvline td{border-top:1 solid #000000;font:1px;filter:alpha(opacity=30)}
--></mce:style><style mce_bogus="1"> .tvline{width:240p ......
最近太忙,没有时间总结工作内容了,忙里偷闲吧,共享下我的JavaScript MD5 脚本
var hex_chr = "0123456789abcdef";
function rhex(num)
{
str = "";
for(j = 0; j <= 3; j++)
str += hex_chr.charAt((num >> (j * 8 + 4)) & 0x0F) +
hex_chr.charAt((num >> (j * 8)) & 0x0F);
re ......
在javascript代码中用encodeURIComponent()函数处理中文字符串,
JS代码:
<mce:script type=”text/javascript”><!--
string = encodeURIComponent(string);
location.href = index.php?keyword=’+string;
// --></mce:script>
PHP代码:
<?php
$keyword = (isset($_GET ......
JavaScript中的对象
关键词: JavaScript 对象 ......