当前位置: 首页 > 图文教程 > 网络编程 > Javascript > SelectBox in Frame

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 SelectBox in Frame


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-10   浏览: 309 ::
收藏到网摘: n/a

SelectBox in Frame本页面已经包括在下载文件中了

首先,建立Frameset帧结构,为每个frame页面起名(红色部分):

<FRAMESET COLS="134,*" FRAMEBORDER="0">
<FRAME SRC="nav.htm" SCROLLING="NO" name="left">
<FRAME SRC="main.htm" name="right">
</FRAMESET>

以上请自己调整适应自己的页面。

下面是左侧的页面nav.htm的代码:

<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!--
function selectbox(indexbox) {

parent.right.location.href = document.selectform.select.options[indexbox].value;
}
//-->
</SCRIPT>

<BODY BGCOLOR="WHITE">

<FORM name="selectform">
<div align="center">
<SELECT onChange="selectbox(this.selectedIndex);" SIZE=6 name="select">
<OPTION VALUE="link1.htm">连接页面1
<OPTION VALUE="link2.htm">连接页面2
<OPTION VALUE="link3.htm">连接页面3
<OPTION VALUE="link4.htm">连接页面4
<OPTION VALUE="link5.htm">连接页面5
<OPTION VALUE="link6.htm">连接页面6 //一共6个连接页面,与上面的数字一致。
</SELECT>
</div>
</FORM>

</BODY>
</HTML>

右侧的页面随便。注意:颜色相同部分要一致。right是左侧的frame的名字啊。

如果不需要在FRAME中打开页面,用location替换parent.right.location.href 即可在全页面打开连接,当然不必再建立FRAMESET了。