Jump to content

Loading Link From Drop Down Menu Into An Iframe


Recommended Posts

I have a little predicament trying to find a way to load the options from my drop down menu into an iframe on the same page. Ex: I want to click an option in my drop down menu on the home page, which will then load an html page into an iframe, which is on the home page.This is what I have so far:<head>

<script type="text/javascript">  function submitForm() {  var list = document.navList.subMenu;  var page = list.options[ list.selectedIndex ].value;	if (page != "home")	window.location = page;  return false;}</script>


<form name="navList" onsubmit="return submitForm();" action="">	<select name="subMenu">	  <option>--Select A Job--</option>	  <option>Health & Safety Officer</option>	  <option>Lean Coordinator</option>	  <option>Fixturing Technicians</option>	  <option>Quality Assurance/Inspection Roles</option>	  <option>Administration staff</option>	  <option>Detailers</option>	  <option>Assemblers</option>	  <option>CNC Programmers</option>	  <option>CNC Operators</option>	  <option>Engineers</option>	  <option>Human Resources</option>	  <option>Shipping/Receiving</option>	</select>  <input type="submit" value="Go"></form><iframe name="job"></iframe>

I'm just not sure where to go from here. Anyone?

Edited by MattDoherty
Link to comment
Share on other sites

Give your options a value:<option value="page1.html">Health & Safety Officer</option>And give your iframe an ID:<iframe name="job" id="job_frame">Then you can replace this:window.location = page;with this:document.getElementById('job_frame').src = page;
Thanks a lot! I really appreciate it. It works like a charm :)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...