蓝森林首页 | 返回主页 | 本站地图 | 站内搜索 | 联系信箱 |
 您目前的位置:首页 > 自由软件 > 技术交流 > 应用编程


    

蓝森林 http://www.lslnet.com 2006年8月25日 8:28

request() 用js应该怎么写?

a.asp?a=11
在a.asp中
<%=request("a")%>
这段代码用js应该怎么写?

试试
[code]
function stringhrefParams( Aparams){
  var Exp = new RegExp(".*(\\?|&)"+Aparams+"=","g")
  if (Exp.test(location.search))
    return location.search.replace(Exp,"").replace(/&.*/g,"")
  else
    return ""
}
[/code]

晕。我怎么一句都看不懂啊。
我想实现的是这样的功能。连接地址是:aaa.asp?name=<%=request("name")%>
我想做的就是下面的。。。虽然是错误的
[html]
<script language="javascript">
<!--
function openscriphtml()
{
newwin=window.open('aaa.asp?name=<%=request("name)%>','','width=544,height=294');
newwin.focus();
}
//-->
</script>
<a href="javascript:openscriphtml()">sldkfjd</a>
[/html]

刚才开会,是在开会之前随手写的。

我写的这个脚本只是用来获取参数的而已,也就是只能获取?之后的参数。

看你的代码,就类似:

[code]
<script>
function stringhrefParams(xxx){...}
function openscriphtml()
{
...
newwin=window.open('aaa.asp?name='+stringhrefParams('name'),'','width=544,height=294');
...
}
</script>
...
[/code]


谢谢。。。可以了。好像看明白了。

参考一下:
[html]
<script language="javascript">
<!--
var arr=location.search.replace(/\?/g,"").split("&")
alert(document.URL)
alert(arr[0])
alert(arr[1])
//-->
</script>
[/html]




Copyright © 1999-2000 LSLNET.COM. All rights reserved. 蓝森林网站 版权所有。 E-mail : webmaster@lslnet.com