View Full Version : Javascript solution for Form target
mkdowning05
07-09-2009, 04:27 PM
Hello all! I am very new to JavaScript, and I have a quick question. I am building a webpage that is in two separate frames (I didn't really want to do frames, but the owner of the site did.....). At any rate, I have my navigation in the left frame, named "content", along with a drop-down form where you can also search for a specific brand, and click go. But, once you click go, right now you only get an error message. I think I need to specify a target, and everything I searched for said that I needed the target to be in JS, not HTML. So basically.. I need to know how to move the output of this form (form name="form") into the second frame (it's name is "main"). Any help would be greatly appreciated. Thanks!
mkdowning05
07-11-2009, 11:11 PM
Well... I guess maybe I'll be a little clearer? I've searched Google for several solutions, and found a few, tried them... and nothing works so far. I thought it would be a little simpler than what it is ending up being. I've tried just putting target="main" in both the beginning of the form, and also in the JavaScript for the form, but neither of them worked. I've also tried quite a few other solutions, without any progress. I was just hoping someone could maybe explain to me what I'm doing wrong?
mkdowning05
07-14-2009, 01:07 PM
I suppose since I figured this out, and nobody took a stab at it... I'm going to post it anyway.. my form was just named "form"... with two separate frames.. the one on the left that houses the navigation and form is named "contents" and the right one that houses the main content is named "main"...
<script LANGUAGE="JavaScript">
function formHandler(form){
var URL = document.form.site.options[document.form.site.selectedIndex].value;
window.location.href = URL;
top.frames['main'].location.href = URL;;
top.frames['contents'].location.href = 'sidebar.htm';;
}
</script>
So basically....
top.frames[*framename*].location.href = *wherever you want it to go*
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.