...

View Full Version : How do I get this combobox to open page in another frame?



Andreas Sweden
05-27-2005, 03:02 PM
function gone()
{
location=document.jumpy.example.options[document.jumpy.example.selectedIndex].value
}
//-->
</script>

</form>


What do I change for this combobox to open the page in another frame?

Kor
05-27-2005, 03:31 PM
function gone()
{
window.open(document.jumpy.example.options[document.jumpy.example.selectedIndex].value,'framename')
}

Andreas Sweden
05-27-2005, 03:40 PM
Thank you very much, I have to start learning this stuff and stop cuting and pasting :)

Kor
05-27-2005, 04:36 PM
the method is

window.open(url,target,attributes)

The method's arguments are all strings (or variables set as strings). Attributes must be separated by commas ('width=500,height=300,left=10'). Target and attributes are optional. If no target, the default target is _blank. If no attributes, the opened window has different size and position according to the browser type. Attributes may hide scroolbar, location bar, toolbar and so on...

See also
http://www.devguru.com/Technologies/ecmascript/quickref/win_open.html

rlemon
05-27-2005, 05:52 PM
JS


function mnu_func(opt){
var myOpt = document.getElementById("mnu_"+opt);
var myFrame = document.getElementById('frameID');
myFrame.src = myOpt;
myFrame.focus();
}


HTML


<select onChange="mnu_func(this.selectedIndex)">
<option id="mnu_0" value="option1.html">option1</option>
<option id="mnu_1" value="option2.html">option2</option>
<option id="mnu_2" value="option3.html">option3</option>
<option id="mnu_3" value="option4.html">option4</option>
<option id="mnu_4" value="option5.html">option5</option>
<option id="mnu_5" value="option6.html">option6</option>
<option id="mnu_6" value="option7.html">option7</option>
<option id="mnu_7" value="option8.html">option8</option>
</select>


however I think this will only work with iframes.

for frames using frameset you might have to replace
var myFrame = document.getElementById('frameID');

with

var myFrame = parent.frameName;
(also might want to try self.frameName - i havn't tested this).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum