Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Web Design & Development
Tag Cloud
access acer asus bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory modem monitor motherboard network printer problem ram registry router security slow software sound toshiba trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Jump Menu And IFrames

Reply  
Thread Tools
Cravepain's Avatar
Senior Member with 108 posts.
 
Join Date: May 2007
Experience: Beginner
07-May-2008, 10:39 PM #1
Jump Menu And IFrames
Hello,

I have made a thread on here before regarding my website, and I got plenty of help. Now, I have another issue. I have tried to solve this one myself, but it doesn't seem to be working out. I'm sorry guys - I am trying.

I have a Jump Menu created which I want to open up in a certain IFrame I have. What it is doing now is simply taking over the whole page.

Here is the code I have. I would like for it to open up in a IFrame named content-frame:

<select name="jumpMenu" id="jumpMenu" onChange="MM_jumpMenu('parent',this,0)">
<option value="about.html">About Me</option>
<option value="chemical.html">Chemicals</option>
<option value="comments.html">Comments</option>
<option value="coupons.html">Coupons</option>
<option value="directions.html">Directions</option>
<option value="hair.html">Hair</option>
<option value="hairremoval.html">Hair Removal</option>
<option value="main.html">Home</option>
<option value="links.html">Links</option>
<option value="products.html">Products</option>
<option value="schedule.html">Schedule</option>
<option value="services.html">Services</option>
</select>


Thank you so much, again, guys. I am sorry for being a pest.
Jayec's Avatar
Junior Member with 7 posts.
 
Join Date: May 2008
08-May-2008, 12:12 AM #2
Try replacing line 1 with:

<select name="jumpMenu" id="jumpMenu" onChange="MM_jumpMenu('content-frame',this,0)">
Cravepain's Avatar
Senior Member with 108 posts.
 
Join Date: May 2007
Experience: Beginner
08-May-2008, 01:43 AM #3
That didn't work. It stopped loading the pages all together.
Jayec's Avatar
Junior Member with 7 posts.
 
Join Date: May 2008
08-May-2008, 02:29 AM #4
Ok. I'm not too familiar with Java
Hopefully someone else will be able to tell you how to modify the scipt used in your site (below).

Code:
<script>
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
</script>
Code:
<select name="jumpMenu" id="jumpMenu" onChange="MM_jumpMenu('parent',this,0)">
<option value="about.html">About Me</option>
<option value="chemical.html">Chemicals</option>
<option value="comments.html">Comments</option>
<option value="coupons.html">Coupons</option>
<option value="directions.html">Directions</option>
<option value="hair.html">Hair</option>
<option value="hairremoval.html">Hair Removal</option>
<option value="main.html">Home</option>
<option value="links.html">Links</option>
<option value="products.html">Products</option>
<option value="schedule.html">Schedule</option>
<option value="services.html">Services</option>
</select>
Cravepain's Avatar
Senior Member with 108 posts.
 
Join Date: May 2007
Experience: Beginner
08-May-2008, 02:37 AM #5
It's alright. Thank you for trying. It was very nice of you.
tomdkat's Avatar
Computer Specs
Distinguished Member with 7,127 posts.
 
Join Date: May 2006
Location: S.F. Bay Area, CA
Experience: Intermediate
08-May-2008, 03:02 PM #6
First, you've got to understand the tools you use so you can use them effectively.

The JavaScript you're using isn't intended to work with iframes. So, some new JavaScript is needed. First, make this change to your iframe:

Code:
<iframe src="main.html" style="margin-top: 0px; padding-top: 0px;" id="content-frame" name="content-frame" frameborder="0" height="100%" scrolling="auto" width="100%">
Note the addition of the id attribute. We will need this to retrieve the iframe element later on.

Now, add a new JavaScript function for your menu:

Code:
function processMenuChoice(menu) {
targetPage=menu.options[menu.selectedIndex].value;
document.getElementById('content-frame').src=targetPage;
}
Thisis the function that will load the page selected from the menu into the iframe. First, it will get the target page from the menu selection. Then, it will fetch the iframe and set the src attribute to the location from the menu selection. At least, that's the idea.

Then, change your select menu to this:
Code:
<select name="jumpMenu" id="jumpMenu" onChange="processMenuChoice(this)">
This will invoke the new JavaScript function instead of the "MM_jumpMenu()" function.

See what happens. I haven't actually tried the code above so it might need some tweaking.

Peace...
Reply

Tags
iframe, javascript

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools


Similar Threads
Title Thread Starter Forum Replies Last Post
Lexar Jump Jump Drive 256 MB USB 2.0 Arditi All Other Software 8 19-Dec-2005 03:58 PM
Iframes Help!! simonshort Software Development 9 11-Apr-2005 05:48 PM
iFrames Tazbaby4me Web Design & Development 1 05-Mar-2005 03:27 PM
HELP! Jump Menu Creating Trooper_fan Web Design & Development 5 18-Nov-2004 01:04 AM
Jump menu in Dreamweaver ashras99 Web Design & Development 3 09-Sep-2004 08:26 AM


Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 10:16 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.