框架页面子页面同时页面内定位的方法


关键点:在触发事件的Javascript中使用parent.frames(“framePageName”)获取框架页面的引用,
然后通过该引用设置location属性为framePageName.html#idstr即可实现各个框架页面同时页内定位
index.html部分代码:
<FRAMESET COLS=”20%,80%” onLoad=”top.loadFrames()”>
<FRAME SRC=”tree.html” NAME=”tree” SCROLLING=”auto”>
<FRAMESET ROWS=”25%,25%,25%,25%” onLoad=”top.loadFrames()”>
<FRAME SRC=”profile.html” NAME=”profile” SCROLLING=”auto”>
<FRAME SRC=”testcode.html” NAME=”testcode” SCROLLING=”auto”>
<FRAME SRC=”log.html” NAME=”log” SCROLLING=”auto”>
<FRAME SRC=”report.html” NAME=”report” SCROLLING=”auto”>
</FRAMESET>
tree.html页面的Javascript代码:
<SCRIPT type=”text/javascript”>
function linkClick(sectionId, testcode) {
parent.frames(“profile”).location = “profile.html#” + sectionId
parent.frames(“testcode”).location = “testcode.html#” + testcode
parent.frames(“log”).location = “log.html#” + sectionId
parent.frames(“report”).location = “report.html#” + sectionId
}
</SCRIPT>
Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s