做demo演示的时候,遇到了一点小小的麻烦。昨天改的demo,今天又要调整,而且是涉及到每个页面的部分,所以更改起来,甚是麻烦!
所以用了个iframe,这个麻烦,就解决了!! :idea:
具体是这样的:对二级的菜单进行调整,如果没有iframe的话,那么每个二级页面都需要调整;如果新建一个二级菜单(sub_menu.html)文件的话,再在每个页面里相应的调用这个页面,这样只需要更改sub_menu.html页面,所有的页面也就改动了。 :wink:
新建的sub_menu.html页面(把二级菜单放在这个页面)
[code="sub_menu.html"]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<div id="leftMenu">
<dl>
<dt>上衣</dt>
<dd><a href="#" target="_parent">外套</a></dd>
<dd><a href="#" target="_parent">打底衫</a></dd>
</dl>
<dl>
<dt>裤子</dt>
<dd><a href="#" target="_parent">牛仔裤</a></dd>
<dd><a href="#" target="_parent">休闲裤</a></dd>
</dl>
</div>
</html>[/code]
[color=red]注意:“[color=blue]target="_parent"[/color] “为必须填写的部分[/color]
然后利用iframe来调用sub_menu.html页面
[code="html"]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<iframe src="leftMemu.html" frameborder="0" scrolling="no" width="178" height="500" ></iframe>
</body>
</html>[/code]
[color=red]注意:一定要确定宽高和是否显示滚动条,以及框架的边框为‘0’[/color]