一个页面传递参数到已有页面怎么做啊?

就像九天音乐网那样。点击音乐后传递音乐的信息到已有页面并更新播放列表。是怎么实现的??请问怎么实现可以具体点说说嘛??我是像达到从主页或者其他的页面发送请求,改变播放页面... 就像九天音乐网那样。
点击音乐后传递音乐的信息到已有页面并更新播放列表。
是怎么实现的??
请问怎么实现可以具体点说说嘛??
我是像达到从主页或者其他的页面发送请求,改变播放页面的的列表信息.这样的...
a页面传到B页面
B页面是已经打开了的
展开
 我来答
wangcf0224
2010-04-28
知道答主
回答量:8
采纳率:0%
帮助的人:0
展开全部
url传递的参数是放在request的param中的
jsp php asp 都有相应的方法从request取出 param
开发者之路
2010-04-28 · TA获得超过910个赞
知道大有可为答主
回答量:2031
采纳率:0%
帮助的人:939万
展开全部
这是用JS做到的.
比如利用Ajax 就可以做到,不是太复杂!
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
186044
推荐于2016-02-28 · TA获得超过1966个赞
知道大有可为答主
回答量:848
采纳率:0%
帮助的人:1321万
展开全部
两个页面:
a.html:添加歌曲的页面

<SCRIPT language=javascript>
/**
* This js provide a simple way to operate cookie in javascript
* function getCookie(name);
* function setCookie(name,value[,expireDays]);
* function deleteCookie(name);
*/
function getCookie(name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal(j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return "";
}

function setCookie(name, value)
{
var argv = setCookie.arguments;
var argc = setCookie.arguments.length;
var expDay = (argc > 2) ? argv[2] : -1;
try
{
expDay = parseInt(expDay);
}
catch(e)
{
expDay = -1;
}
if(expDay < 0) {
setCookieVal(name, value);
} else {
var expDate = new Date();
// The expDate is the date when the cookie should expire, we will keep it for a month
expDate.setTime(expDate.getTime() + (expDay * 24 * 60 * 60 * 1000));
setCookieVal(name, value, expDate);
}
}

function deleteCookie(name)
{
var exp = new Date();
exp.setTime(exp.getTime() - 1);
// This cookie is history
var cval = getCookie(name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

function getCookieVal(offset)
{
var endstr = document.cookie.indexOf(";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

function setCookieVal(name, value)
{
var argv = setCookieVal.arguments;
var argc = setCookieVal.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape(value) +
((expires == null || expires < 0) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}

function setSong(sName,sUrl)
{
var sNum = getCookie("sNum");
if(sNum<1) sNum=1; else sNum++;

setCookie('s'+sNum,sName);
setCookie('a'+sNum,sUrl);
setCookie('sNum',sNum);
//alert(getCookie("sNum"));
//return;
alert(getCookie('s'+sNum)+" "+getCookie('a'+sNum)+" "+getCookie("sNum"));
}
</SCRIPT>
<a href="javascript:void(0)" onclick="setSong('第1首歌','http://www.baidu.com/1.mp3');">第1首歌</a></br>
<a href="javascript:void(0)" onclick="setSong('第2首歌','http://www.baidu.com/2.mp3');">第2首歌</a></br>
<a href="javascript:void(0)" onclick="setSong('第3首歌','http://www.baidu.com/3.mp3');">第3首歌</a></br>
<a href="javascript:void(0)" onclick="setSong('第4首歌','http://www.baidu.com/4.mp3');">第4首歌</a></br>
<a href="javascript:void(0)" onclick="setSong('第5首歌','http://www.baidu.com/5.mp3');">第5首歌</a></br>
<a href="javascript:void(0)" onclick="setSong('第6首歌','http://www.baidu.com/6.mp3');">第6首歌</a></br>
<a href="javascript:void(0)" onclick="setSong('第7首歌','http://www.baidu.com/7.mp3');">第7首歌</a></br>
<a href="javascript:void(0)" onclick="setSong('第8首歌','http://www.baidu.com/8.mp3');">第8首歌</a></br>
<a href="javascript:void(0)" onclick="setSong('第9首歌','http://www.baidu.com/9.mp3');">第9首歌</a></br>
<a href="javascript:void(0)" onclick="setSong('第10首歌','http://www.baidu.com/10.mp3');">第10首歌</a></br>

b.html:显示歌曲的页面

<SCRIPT language=javascript>
/**
* This js provide a simple way to operate cookie in javascript
* function getCookie(name);
* function setCookie(name,value[,expireDays]);
* function deleteCookie(name);
*/
function getCookie(name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal(j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return "";
}

function setCookie(name, value)
{
var argv = setCookie.arguments;
var argc = setCookie.arguments.length;
var expDay = (argc > 2) ? argv[2] : -1;
try
{
expDay = parseInt(expDay);
}
catch(e)
{
expDay = -1;
}
if(expDay < 0) {
setCookieVal(name, value);
} else {
var expDate = new Date();
// The expDate is the date when the cookie should expire, we will keep it for a month
expDate.setTime(expDate.getTime() + (expDay * 24 * 60 * 60 * 1000));
setCookieVal(name, value, expDate);
}
}

function deleteCookie(name)
{
var exp = new Date();
exp.setTime(exp.getTime() - 1);
// This cookie is history
var cval = getCookie(name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

function getCookieVal(offset)
{
var endstr = document.cookie.indexOf(";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

function setCookieVal(name, value)
{
var argv = setCookieVal.arguments;
var argc = setCookieVal.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape(value) +
((expires == null || expires < 0) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}

function showSong()
{
var sNum = getCookie("sNum");
if(sNum<1) return;
a="";
for(i=1;i<=sNum;i++)
{
a+="<li>"+getCookie('s'+i)+" "+getCookie('a'+i)+"</li>";
}
document.getElementById("songlist").innerHTML = a;
}
speed=500;
var MyMar=setInterval(showSong,speed);
</script>

<ul id="songlist"></ul>
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式