JavaScript Source Code 3000: Forms: Pass Menu (in frames)
Pass Menu (in frames)
After the user selects an option in the pulldown menu in the left frame, JavaScript can pass that option's value into a text box in the right frame when the button is clicked. Cool!
Click to
[ Simply close the demo window to return to this page. ]
JavaScript Source Code 3000: Forms: Pass Menu (in frames)
Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Apple-s). The script is yours!!!
<!-- THREE STEPS TO INSTALL PASS MENU (IN FRAMES):
1. Copy the entire first code section into your FRAMESET document
2. Save the second code into a new page, pass-menu-framesl.html
2. Paste the second code into a new page, pass-menu-framesr.html -->
<!-- STEP ONE: Paste this entire code into your FRAMESET page -->
<html>
<head>
<script language="JavaScript">
<!-- Original: Ronnie T. Moore -->
<!-- Web Site: JavaScript Source Code 3000 -->
<! >
<! >
<!-- Begin
function passText(str) {
top.frames['right'].document.yourform.msg.value = str;
}
// End -->
</script>
</head>
<frameset cols="300,*" frameborder=1>
<frame name="left" src="pass-menu-framesl.html">
<frame name="right" src="pass-menu-framesr.html">
</frameset>
</form>
</body>
</html>
<!-- STEP TWO: Copy this code into a new page -->
<!-- Save the page as: pass-menu-framesl.html -->
<html>
<body>
<center>
<form name=myform>
Select an Option:<br>
<select name="site" size=1>
<option value="">Go to....
<option value="http://www.yahoo.com">Yahoo
<option value="http://www.metacrawler.com">Metacrawler
<option value="http://www.altavista.digital.com">Altavista
<option value="http://www.webcrawler.com">Webcrawler
<option value="http://www.lycos.com">Lycos
<option value="http://javascript.internet.com">JavaScript Source
</select>
<input type=button value="Ok!" onClick="parent.passText(this.form.site.options[this.form.site.selectedIndex].value);">
</form>
</center>
</body>
</html>
<!-- STEP THREE: Copy this code into a new page -->
<!-- Save the page as: pass-menu-framesr.html -->
<html>
<body>
<form name=yourform>
<input type=text name=msg size=35 value="">
</form>
</body>
</html>
<p><center>
<font face="arial, helvetica" SIZE="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">JavaScript Source Code 3000</a></font>
</center><p>
<!-- Script Size: 1.42 KB -->
Wyszukiwarka
Podobne podstrony:
menu framesmixed menu framespass textbox frameschange 2 frames menu sourcepu srvc menu nlmenu cwiczenia14więcej podobnych podstron