<!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>
<title>无标题页</title>
<script language ="javascript">
//************url参数管理对象************************//
//根据传进来的url生成一个键值对对象,(入参可为含有参数的URL,最多为一个)
//***************************************************//
function UrlParmManager()
{
this.Location = window.location.href; //当前url的值
if(this.arugments)
{
if(this.arguments.length > 0)
{
//含有传进url参数
this.Location = this.arguments[0];
}
}
this.classID = this;
this.ParmsArray = new Array(); // 键值对数组
this.init();
}
UrlParmManager.prototype.init = function(){
// 初始化对象
var parms = new String(this.Location);
var obj = new String();
var start = parms.indexOf ("?") + 1;
if(start== 0)
return; //没有参数返回
var end = parms.length
parms = parms.substring(start,end);
this.ParmsArray = parms.split ("&");
}
//url的参数是否为空
UrlParmManager.prototype.CheckParm = function(){
var clsid = this.classID;
if(clsid.ParmsArray.length < 1)
{
return false; //返回false表示数组为空
}
return true;
}
//获得url中的参数对象
UrlParmManager.prototype.GetObj = function(){
var clsid = this.classID;
var length = clsid.ParmsArray.length;
var mlArray;
var objUrl ="";
var obj;
objUrl += "{";
for(var i = 0;i < length;i++)
{
mlArray = clsid.ParmsArray[i].toString().split("=");
objUrl += "/"";
objUrl += mlArray[0];
objUrl += "/"";
objUrl += ":";
objUrl +=mlArray[1];
objUrl += ",";
}
if(length > 0)
{
objUrl = objUrl.substring (0,objUrl.length -1);
}
objUrl += "}";
obj = eval("("+objUrl+")");
return obj;
}
//调用方法
window.onload = function (){
var obj = new UrlParmManager();
if(obj)
{
if(obj.CheckParm())
{
var urlOb =obj.GetObj();
}
}
}
</script>
</head>
<body>
<a href ="hTMLPage.htm?ssdd=23&ts=22">本页面</a>
</body>
</html>
<html xmlns=" http://www.w3.org/1999/xhtml" >
<head>
<title>无标题页</title>
<script language ="javascript">
//************url参数管理对象************************//
//根据传进来的url生成一个键值对对象,(入参可为含有参数的URL,最多为一个)
//***************************************************//
function UrlParmManager()
{
this.Location = window.location.href; //当前url的值
if(this.arugments)
{
if(this.arguments.length > 0)
{
//含有传进url参数
this.Location = this.arguments[0];
}
}
this.classID = this;
this.ParmsArray = new Array(); // 键值对数组
this.init();
}
UrlParmManager.prototype.init = function(){
// 初始化对象
var parms = new String(this.Location);
var obj = new String();
var start = parms.indexOf ("?") + 1;
if(start== 0)
return; //没有参数返回
var end = parms.length
parms = parms.substring(start,end);
this.ParmsArray = parms.split ("&");
}
//url的参数是否为空
UrlParmManager.prototype.CheckParm = function(){
var clsid = this.classID;
if(clsid.ParmsArray.length < 1)
{
return false; //返回false表示数组为空
}
return true;
}
//获得url中的参数对象
UrlParmManager.prototype.GetObj = function(){
var clsid = this.classID;
var length = clsid.ParmsArray.length;
var mlArray;
var objUrl ="";
var obj;
objUrl += "{";
for(var i = 0;i < length;i++)
{
mlArray = clsid.ParmsArray[i].toString().split("=");
objUrl += "/"";
objUrl += mlArray[0];
objUrl += "/"";
objUrl += ":";
objUrl +=mlArray[1];
objUrl += ",";
}
if(length > 0)
{
objUrl = objUrl.substring (0,objUrl.length -1);
}
objUrl += "}";
obj = eval("("+objUrl+")");
return obj;
}
//调用方法
window.onload = function (){
var obj = new UrlParmManager();
if(obj)
{
if(obj.CheckParm())
{
var urlOb =obj.GetObj();
}
}
}
</script>
</head>
<body>
<a href ="hTMLPage.htm?ssdd=23&ts=22">本页面</a>
</body>
</html>