CSS+DIV:如何在一个盒子中点超链后让另一个盒子调入另一网页

needacoder 2012-01-31 09:15:47
如何在一个DIV盒子中点超链后让另一个DIV盒子调入另一网页:*.html,*.asp, *.aspx等

也就是用任意静态或动态网页局部刷新页在中的某个DIV盒子

最好只用js的

ajax我根本不会
...全文
402 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
julyyq 2012-03-17
  • 打赏
  • 举报
回复
用onclick事件绑定你点击的DIV,然后在事件处理函数中打开另外你一个DIV中的链接,不就可以了。如果不懂,把源代码贴出来,我给你写好js程序。
JaniTang2011 2012-03-15
  • 打赏
  • 举报
回复
<html>
<head>
<title>Untitled Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=GBK" />

<script type="text/javascript">
var req;
function createXmlHttp() {
try {
return new XMLHttpRequest();
} catch (e1) {
try {
return new ActiveXObject("Msxml2.XMLHTTP");
} catch (e2) {
try {
return new ActiveXObject("Microsoft.XMLHTTP");
} catch (e3) {
return null;
}
}
}
}
function getPage(path) {
req = createXmlHttp();
if (req) {
req.onreadystatechange = hdlRsp;
req.open("GET", path, true);
req.send(null);
} else {
alert("浏览器不支持!");
}
}
function hdlRsp() {
if (req.readyState == 4 && req.status == 200) {
var rspText = req.responseText;
if (rspText != "") {
document.getElementById("display").innerHTML = rspText;
alert(rspText);
document.getElementById("display").style.visibility = "visible";
}
else document.getElementById("display").style.visibility = "hidden";
}
}
</script>

</head>
<body>
<div id="display" style="width: 500px; height: 500px; overflow: scroll; border: 1px solid #ccc;">
 </div>
<br />
<input type="button" value="显示外部文本" onclick="getPage('http://www.baidu.com')" />
</body>
</html>
needacoder 2012-03-15
  • 打赏
  • 举报
回复
高手会来的
cdcjk 2012-03-14
  • 打赏
  • 举报
回复
高手啊,出手吧
needacoder 2012-03-14
  • 打赏
  • 举报
回复
高手就要来了
thinclient 2012-03-03
  • 打赏
  • 举报
回复
高手啊,出手吧
thinclient 2012-02-27
  • 打赏
  • 举报
回复
马甲顶起,等待高手!
needacoder 2012-02-23
  • 打赏
  • 举报
回复
frame不行,慢
Sunny红红 2012-02-22
  • 打赏
  • 举报
回复
用frame行么
needacoder 2012-02-19
  • 打赏
  • 举报
回复
自已顶
needacoder 2012-02-15
  • 打赏
  • 举报
回复
没人看到??
needacoder 2012-02-08
  • 打赏
  • 举报
回复
没人看到?

1,450

社区成员

发帖
与我相关
我的任务
社区描述
多媒体/设计/Flash/Silverlight 开发 图象工具使用
社区管理员
  • 图象工具使用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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