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);
})
相关文档:
function BOX_show(e,obj)//显示
{
if(obj<24)
document.cookie = "tdid="+obj;
if(document.getElementById(e)==null)
{
return ;
}
&n ......
程序设计中会经常碰到一种情况,就是事先无法得知用户会需要哪些数据,必须根据用户选择后再从服务器
重新提取数据后反馈给用户。比如一简单的情况,用户选择省份以后,我们立即会在市里边将这个省的所有
市重新显示出来。这种情况一般需要将整个页面刷新后才可以重新读取,但这样不仅效率不高外,也显得不
太优雅。其实 ......
//1.类
function Test(id)
{
this.id=id;
this.method=function()
{
//代码
};
}
......
在javascript代码中用encodeURIComponent()函数处理中文字符串,
JS代码:
<mce:script type=”text/javascript”><!--
string = encodeURIComponent(string);
location.href = index.php?keyword=’+string;
// --></mce:script>
PHP代码:
<?php
$keyword = (isset($_GET ......