<
script type
=
“
text/javascript
“
>
/*
–获取网页传递的参数–
*/
function
request(paras) {
var
url
=
location.href;
var
paramStr
=
url.substring(url.indexOf(
‘
?
‘
)
+
1
, url.length).split(
‘
&
‘
);
var
j;
var
paramObj
=
{};
for
(
var
i
=
0
; j
=
paramStr[i]; i
++
) {
paramObj[j.substring(
0
, j.indexOf(
‘
=
‘
)).toLowerCase()]
=
j.substring(j.indexOf(
‘
=
‘
)
+
1
, j.length);
}
var
returnValue
=
paramObj[paras.toLowerCase()];
if
(
typeof
(returnValue)
==
“
undefined
“
) {
return
“”
;
}
else
{
return
returnValue;
}
}
=
function
() {
alert(request(
“
name
“
));
}
<
/
script>
script type
=
“
text/javascript
“
>
/*
–获取网页传递的参数–
*/
function
request(paras) {
var
url
=
location.href;
var
paramStr
=
url.substring(url.indexOf(
‘
?
‘
)
+
1
, url.length).split(
‘
&
‘
);
var
j;
var
paramObj
=
{};
for
(
var
i
=
0
; j
=
paramStr[i]; i
++
) {
paramObj[j.substring(
0
, j.indexOf(
‘
=
‘
)).toLowerCase()]
=
j.substring(j.indexOf(
‘
=
‘
)
+
1
, j.length);
}
var
returnValue
=
paramObj[paras.toLowerCase()];
if
(
typeof
(returnValue)
==
“
undefined
“
) {
return
“”
;
}
else
{
return
returnValue;
}
}
window.onload
=
function
() {
alert(request(
“
name
“
));
}
<
/
script>
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/13301.html