点击左边菜单,右边对应显示内容,不用iframe,怎么实现??

wolfzone 2010-06-22 08:53:46
最好给些代码,谢啦img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/27.gif][/img]
...全文
1087 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
dw-》插入-》Spry-》spry 选项卡式面板
dw里面有很多这种效果的,比网上封装的好多了,可惜没有人看
mchaojie1 2010-06-23
  • 打赏
  • 举报
回复
建议采用iframe 关于你说的这个问题。应该能解决的。另外还有一种方式 那就是母板。具体实践 自己多想 一下、实践一下。
kevinfongever 2010-06-23
  • 打赏
  • 举报
回复

for(i=0;i<ck.length;i++){
ck[i].style.background="#9c0";
}
flyingyinjun 2010-06-23
  • 打赏
  • 举报
回复
frameset,master或ASCX都可实现
只不过布局要设计好
miao159 2010-06-23
  • 打赏
  • 举报
回复
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>CSS+js实现的后台管理菜单_CodeFans.net</title>
<style type="text/css">
body{font-size:12px;}
ul,li,h2{margin:0;padding:0;}
ul{list-style:none;}
#top{width:900px;height:40px;margin:0 auto;background-color:#cc0}
#top h2{width:150px;height:40px;background-color:#9c0;float:left;font-size:14px;text-align:center;line-height:40px;}
#topTags{width:750px;height:40px;margin:0 auto;background-color:#cc0;float:left}
#topTags ul li{float:left;width:100px;height:25px;margin-right:5px;display:block;text-align:center;cursor:pointer;padding-top:15px;}
#main{width:900px;height:500px;margin:0 auto;background-color:#F5F7E6;}
#leftMenu{width:150px;height:500px;background-color:#009900;float:left}
#leftMenu ul{margin:10px;}
#leftMenu ul li{width:130px;height:30px;display:block;background:#9c0;cursor:pointer;line-height:30px;text-align:center;margin-bottom:5px;}
#leftMenu ul li a{color:#000000;text-decoration:none;}
#content{width:750px;height:500px;float:left}
.content{width:740px;height:490px;display:none;padding:5px;overflow-y:auto;line-height:30px;}
#footer{width:900px;height:30px;margin:0 auto;background-color:#ccc;line-height:30px;text-align:center;}
.content1 {width:740px;height:490px;display:block;padding:5px;overflow-y:auto;line-height:30px;}
</style>
<script type="text/javascript">
window.onload=function(){
function $(id){return document.getElementById(id)}
var menu=$("topTags").getElementsByTagName("ul")[0];//顶部菜单容器
var tags=menu.getElementsByTagName("li");//顶部菜单
var ck=$("leftMenu").getElementsByTagName("ul")[0].getElementsByTagName("li");//左侧菜单
var j;
//点击左侧菜单增加新标签
for(i=0;i<ck.length;i++){
ck[i].onclick=function(){
$("welcome").style.display="none"//欢迎内容隐藏
clearMenu();
this.style.background="yellow";
//循环取得当前索引
for(j=0;j<8;j++){
if(this==ck[j]){
if($("p"+j)==null){
openNew(j,this.innerHTML);//设置标签显示文字
}
clearStyle();
$("p"+j).style.backgroundColor="yellow";
clearContent();
$("c"+j).style.display="block";
}
}
return false;
}
}
//增删标签
function openNew(id,name){
var tagMenu=document.createElement("li");
tagMenu.id="p"+id;
tagMenu.innerHTML=name+" "+"<img src='images/close.gif' style='vertical-align:middle'/>";
//点击事件
tagMenu.onclick=function(evt){
clearMenu();
ck[id].style.background="yellow";
clearStyle();
tagMenu.style.backgroundColor="yellow";
clearContent();
$("c"+id).style.display="block";
}
//关闭点击
tagMenu.getElementsByTagName("img")[0].onclick=function(evt){
evt=(evt)?evt:((window.event)?window.event:null);
if(evt.stopPropagation){evt.stopPropagation()} //取消opera和Safari冒泡行为;
this.parentNode.parentNode.removeChild(tagMenu);//删除当前标签
var color=tagMenu.style.backgroundColor;
//设置如果关闭一个标签时,让最后一个标签得到焦点
if(color=="#ffff00"||color=="yellow"){//区别浏览器对颜色解释
if(tags.length-1>=0){
clearStyle();
tags[tags.length-1].style.backgroundColor="yellow";
clearContent();
var cc=tags[tags.length-1].id.split("p");
$("c"+cc[1]).style.display="block";
clearMenu();
ck[cc[1]].style.background="yellow";
}
else{
clearContent();
clearMenu();
$("welcome").style.display="block"
}
}
}
menu.appendChild(tagMenu);
}
//清除菜单样式
function clearMenu(){
for(i=0;i<ck.length;i++){
ck[i].style.background="#9c0";
}
}
//清除标签样式
function clearStyle(){
for(i=0;i<tags.length;i++){
menu.getElementsByTagName("li")[i].style.backgroundColor="#FFCC00";
}
}
//清除内容
function clearContent(){
for(i=0;i<7;i++){
$("c"+i).style.display="none";
}
}
}
</script>
</head>
<body>
<div id="top">
<h2>管理菜单</h2>
<div id="topTags">
<ul>
</ul>
</div>
</div>
<div id="main">
<div id="leftMenu">
<ul>
<li>个人资料</li>
<li>相册管理</li>
<li>日志管理</li>
<li>留言管理</li>
<li>软件分类</li>
<li>系统管理</li>
<li>帮助信息</li>
</ul>
</div>
<div id="content">
<div id="welcome" class="content" style="display:block;">

<div align="center">
<p> </p>
<p><strong>欢迎使用后台管理系统!</strong></p>
<p> </p>
</div>
</div>
<div id="c0" class="content">个人资料</div>
<div id="c1" class="content">相册管理</div>
<div id="c2" class="content">日志管理</div>
<div id="c3" class="content">留言管理</div>
<div id="c4" class="content">软件分类</div>
<div id="c5" class="content">系统管理</div>
<div id="c6" class="content">帮助信息</div>
</div>
</div>
<div id="footer">Copyright CodeFans.NET</div>
</body>
</html>
yw1688 2010-06-22
  • 打赏
  • 举报
回复
复制下面的代码到记事本,保存成html就可以了。网上好多都是错误的,用iframe的时候,它有一个src属性,你用它来实现刷新就可以了。

<html>
<head>
<title>测试</title>
<script type="text/javascript">
function a()
{
document.getElementById("cc").src="http://www.google.com.hk";
}
</script>
</head>
<body>
<table width="100%" boder="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="button" value="点击我" onclick="a()"><td>
<td><iframe id="cc" src="http://www.baidu.com" width="600px" height="700px"></iframe></td>
</tr>
</table>
</body>
</html>
mayanly 2010-06-22
  • 打赏
  • 举报
回复
可以使用postbackurl
weishumin 2010-06-22
  • 打赏
  • 举报
回复

还是采用iframe吧。
wuyq11 2010-06-22
  • 打赏
  • 举报
回复
master母版页,通过treeview
wolfzone 2010-06-22
  • 打赏
  • 举报
回复
其实主要是如何点击iframe中按钮刷新iframe所在的页面。。。试过了好多脚本。一直没解决。。。
wolfzone 2010-06-22
  • 打赏
  • 举报
回复
<img src="https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/0.gif" />
ruolins 2010-06-22
  • 打赏
  • 举报
回复
自己写个div吧,
wolfzone 2010-06-22
  • 打赏
  • 举报
回复
我用的就是iframe
不过有个问题
我的项目采用frameset框架结构,top left main
在内容显示区main里,有个iframe
点击iframe里面的button始终无法刷新main里面显示的gridview
不知道我说清楚了没。。
知道的帮个忙哈。。<img src="https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/3.gif" />
bbb332 2010-06-22
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 ciznx 的回复:]
最好还是使用 iframe 吧,这么方便的东西,为什么不用呢
[/Quote]
只会iframe
ciznx 2010-06-22
  • 打赏
  • 举报
回复
最好还是使用 iframe 吧,这么方便的东西,为什么不用呢

62,072

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

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