急!!!!!请求帮忙!!改变location却取不到值!!

ZHANGWEI15 2004-11-09 10:35:21
急!!!!!请求帮忙!!改变location却取不到值!!


我使用类似下列语句为啥不行?????
var strhref=window.location+"?type=100";....
window.location.replace(strhref);
window.location.reload;


远行程序的时候我看到ie的地址览上"?type=100"已经加上
可是我用request.querystring("type")却取不到值,请问大家能这样用吗?
我以前理解是改变location的值然后重新装载一下=在地址览里键入地址然后回车是向服务器端发送请求的
是这样的吗? 如果我要实现这样的功能是不是只能用window.open的功能拉,该怎么做呢!!!!!

...全文
140 11 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
是是非非 2004-11-10
  • 打赏
  • 举报
回复
不能,你试试就知道了
ZHANGWEI15 2004-11-10
  • 打赏
  • 举报
回复
Request.ServerVariables("SCRIPT_NAME")为啥不能换曾window.location
是是非非 2004-11-10
  • 打赏
  • 举报
回复
<?xml version="1.0" encoding="gb2312" standalone="no" ?>
<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="pragma" content="no-cache" />
<title></title>
</head>
<body>
QueryString数据:<%=Request.QueryString%><br />
设置QueryString:TestKey=<input type="text" value="newValue" id="nVal" />
<input type="button" onclick="JavaScript:location.href='<%=Request.ServerVariables("SCRIPT_NAME")%>?TestKey='+nVal.value;" value="传送" />
</body>
</html>
ZHANGWEI15 2004-11-10
  • 打赏
  • 举报
回复
我的目的想把QueryString放在原来的url的后面然后提交到服务器.

其实就是发送给request请求给server再次请求页面!!!
notata 2004-11-10
  • 打赏
  • 举报
回复
同意楼上的,直接location.href=location.href+'?KEY=VALUE'
是是非非 2004-11-10
  • 打赏
  • 举报
回复
window.location.href = window.location.href;这个是刷新本页
location.reload也是刷新本页

你想改变本页的QueryString就不能使用刷新功能
直接location.href=location.href+'?KEY=VALUE'就可以了
qiekong 2004-11-10
  • 打赏
  • 举报
回复

try

var strhref=window.location+"?type=100";....

var type = window.location.search.split("&")[0]
ZHANGWEI15 2004-11-10
  • 打赏
  • 举报
回复
why?我把window.location的值alert出来和Request.ServerVariables("SCRIPT_NAME")看到是一样的哦!!
ZHANGWEI15 2004-11-09
  • 打赏
  • 举报
回复
我试过了好像不行哦,下面试啥意思!!
window.location.href = window.location.href;

看看我的帖子把!

http://community.csdn.net/Expert/topic/3537/3537513.xml?temp=.8300287
ZHANGWEI15 2004-11-09
  • 打赏
  • 举报
回复
上面有点写错了:
我的代码是这样的:

window.location.href=strhref;
window.location.replace(strhref);

这两行代码都不能改变ie中的值!!!!
我的目的是再客户端修改window.location的值并提交然后可以用request.querystring取到!!!!
ttyp 2004-11-09
  • 打赏
  • 举报
回复
try

var strhref=window.location+"?type=100";....
window.location.replace(strhref);
window.location.href = window.location.href;

87,997

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧