不经过服务端,如何在两个页面间传递数据?

aZhuang 2003-04-29 05:23:10
不经过服务端,如何在两个页面间传递数据?
...全文
58 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
aZhuang 2003-04-30
  • 打赏
  • 举报
回复
补充:wsj(骆驼)(从麻木中苏醒)的方法好像还是要通过服务端的呀,因为点了链接以后浏览器是从服务端读取目标页面的。
aZhuang 2003-04-30
  • 打赏
  • 举报
回复
抱歉,我问的不清楚,net_lover(孟子E章)(又是你啊,呵呵~~)的回答正是我的意思:用Open方法打开一个窗口后,怎么在新窗口和原来的窗口接传递数据。我试了,用Opener属性可以达到目的。其余两位的方法似乎适用于没有关联的任意窗口之间,但我还没试。先结贴了吧。:)
lsaturn 2003-04-29
  • 打赏
  • 举报
回复
http://mysite/home.asp?id=1
就可以传递数据了吧?
wsj 2003-04-29
  • 打赏
  • 举报
回复
?不经过服务器?

这样吗?

a.htm
-----
<a href="b.htm?id=1">b</a>


b.htm
-------
id=queryString(location.href, "id")
function queryString(strURL, strParam)
{
var strVal = "";

try
{
// if strURL = "http://www.mySite.com/myPage.htm?param1=val1¶m2=val2"
var nIndex = strURL.indexOf("?");
if (nIndex > 0)
{
// cut strURL into "¶m1=val1¶m2=val2"
strURL = "&" + strURL.substring(nIndex + 1, strURL.length);
nIndex = strURL.indexOf("&"+ strParam + "=");
if(nIndex >= 0)
{
// jump to the position after the equal sign, if we're looking for
// param1, then strURL should contain 'val1¶m2=val2'
strURL = strURL.substring(nIndex + strParam.length + 2, strURL.length);

// in case there are other parameters followed
nIndex = strURL.indexOf("&");
if(nIndex == -1) //find the target
strVal = strURL;
else
strVal = strURL.substring(0, nIndex); // strVal should be 'val1' now
}
}
}
catch(e){}

return strVal;
}
</script>
孟子E章 2003-04-29
  • 打赏
  • 举报
回复
引用窗口:比如:
opener.varA
opener.document.formname.inputname.value

61,115

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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