javascript检测 .net Framework
通过请求的header中可以看到 User-Agent 项
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; Tablet PC 2.0; CIBA)
这里记录了本地信息,通过这里的.Net CLR xxxxx,可以判断出用户是否安装了指定版本的.net Framework。
本人不太熟悉正则,只能用笨方法写一个了,呵呵
function hasDotNetFramework(baseVersion) {
if (typeof baseVersion == "undefined") baseVersion = 1;
var userAgent = navigator.userAgent.toLowerCase();
for (var i = baseVersion; i < 10; i++) {
if (userAgent.indexOf('.net clr ' + i + '.') > -1) {
return true;
}
}
return false;
}
if(hasDotNetFramework(2))
{
alert("已经安装.net framework 2.0");
}
else
{
alert("未安装.net framework2.0");
}
相关文档:
页面提交数据一般有两种方法:get,post。post就是所谓的form提交,使用视图;get是通过url提交。
Get方法一般用后台代码(如asp,asp.net)获得参数,代码很简单:Request.QueryString["id"];即可获取。
有些时候需要直接在前台获取url参数,要用到javascript,js没有直接获取url参数的方法,那么,我们如何通过js ......
由于火狐浏览器不支持“removeNode”函数,所以一下代码只支持IE.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
< ......
1 history.go(0)
2 location.reload() (页面进行刷新,但为disabled的元素的值不会被清空)
3 location=location
4 location.assign(location)
5 location.replace(location)
6 from..reset() (页面不进行刷新,模拟单击对所调用表单重置按钮的单击)
......
原文出处: http://www.dnew.cn/post/196.htm
先看下下面几种写法
1.function f(x){return x*x;};f(x);
2.(function(x){return x*x;})(x);
3.(function(x){return x*x;}(x));
第一种我们应该都很熟悉了,这是我们经常使用的写法。第二第三种都是匿名函数的写法。
------------------------------------------------ ......
除了用getElementByTagName 的另一种获取对象集合的方法
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" conte ......