iframe 里的src传递参数问题

q215683909 2013-01-25 11:03:40
先贴上代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wb="http://open.weibo.com/wb">
<head>
<title>test.html</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<script src="http://tjs.sjs.sinajs.cn/open/api/js/wb.js?appkey=816804488" type="text/javascript" charset="utf-8"></script>
</head>

<body>
This is my test page. <br>
<div>
<a href=#>
<img src="http://www.wineimg.com/userfiles/image/2013/01/20/SuperStar_24.jpg" width="131" height="35" />
</a>
<a href=#>
<img src="http://www.wineimg.com/userfiles/image/2013/01/20/SuperStar_24.jpg" width="131" height="35" />
</a>
<a href=#>
<img src="http://www.wineimg.com/userfiles/image/2013/01/20/SuperStar_24.jpg" width="131" height="35" />
</a>
</div>
===============================================分割线=========================================================
<div class="contimg">
<a name="result"></a>
<iframe width="100%" height="500" frameborder="0" scrolling="no" src="http://widget.weibo.com/livestream/listlive.php?language=zh_cn&width=0&height=500&uid=&skin=1&refer=1&appkey=&pic=0&titlebar=1&border=1&publish=1&atalk=1&recomm=0&at=0&atopic=&ptopic=%E9%85%92%E7%BE%8E%E7%BD%91&dpc=1">
</iframe>
</div>
</body>
</html>


现在的需求是通过点击分割线上方div的不同图片链接 传递不同的内容到下方div的iframe中的src中的参数 ptopic=%E9%85%92%E7%BE%8E%E7%BD%91 即ptopic是动态的值.
要怎么做,js可以实现吗 ?
在线,等答案
...全文
12408 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
onlyone1221 2014-11-25
  • 打赏
  • 举报
回复
楼主如何解决,,把答案贴出来看看啊
binecy 2014-01-06
  • 打赏
  • 举报
回复
怎么解决???
未知数 2013-01-25
  • 打赏
  • 举报
回复
<img src="http://www.wineimg.com/userfiles/image/2013/01/20/SuperStar_24.jpg" width="131" height="35" alt="AAA" onclick="dd.call(this);" /> <iframe id='oframe' width="100%" height="500" frameborder="0" scrolling="no" src="http://widget.weibo.com/livestream/listlive.php?language=zh_cn&width=0&height=500&uid=&skin=1&refer=1&appkey=&pic=0&titlebar=1&border=1&publish=1&atalk=1&recomm=0&at=0&atopic=&ptopic=%E9%85%92%E7%BE%8E%E7%BD%91&dpc=1"> function dd(){ var id = window.dialogArguments; var url = "http://widget.weibo.com/livestream/listlive.php?language=zh_cn&width=0&height=500&uid=&skin=1&refer=1&appkey=&pic=0&titlebar=1&border=1&publish=1&atalk=1&recomm=0&at=0&atopic=" + "&ptopic="+this.alt; document.getElementById("oframe").src = url; } 行了,只要src被赋值,iframe本就会重新加载
q215683909 2013-01-25
  • 打赏
  • 举报
回复
每个不同的图片链接要给ptopic传递不同的值 ,例如: 第1个<a> 传递 ptopic="AAA" 第2个<a> 传递 ptopic="BBB" 第3个<a> 传递 ptopic="CCC" 还有点击链接后那个iframe 要动态刷新的
q215683909 2013-01-25
  • 打赏
  • 举报
回复
引用 3 楼 wzs_xyz 的回复:
<img src="http://www.wineimg.com/userfiles/image/2013/01/20/SuperStar_24.jpg" width="131" height="35" alt="xxxx.jsp" onclick="dd.call(this);" /> function dd(){ var id = window.dialo……
不是这样啊
未知数 2013-01-25
  • 打赏
  • 举报
回复
<img src="http://www.wineimg.com/userfiles/image/2013/01/20/SuperStar_24.jpg" width="131" height="35" alt="xxxx.jsp" onclick="dd.call(this);" /> function dd(){ var id = window.dialogArguments; var url = this.alt; document.getElementById("oframe").src = url+"?id=" + id; } 是需要这样么?
q215683909 2013-01-25
  • 打赏
  • 举报
回复
<iframe id='oframe' src=""></iframe> <SCRIPT LANGUAGE="JavaScript"> function dd(){ var id = window.dialogArguments; document.getElementById("oframe").src = "A.jsp?id=" + id; } dd(); </SCRIPT> 这个可以吗? 把id换成ptopic ,但是怎么在图片链接里放入写定的值呢?
翔教授 2013-01-25
  • 打赏
  • 举报
回复
http://www.cnblogs.com/ozdoo/archive/2011/09/01/2161936.html
q215683909 2013-01-25
  • 打赏
  • 举报
回复
引用 6 楼 wzs_xyz 的回复:
<img src="http://www.wineimg.com/userfiles/image/2013/01/20/SuperStar_24.jpg" width="131" height="35" alt="AAA" onclick="dd.call(this);" /> <iframe id='oframe' width="100%" height="500"……
哈哈 我刚刚自己也做出来了 谢谢了 这贴就结了吧

87,922

社区成员

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

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