Javascript- remote control Combo box
What is remote control combo means
When you load
this page a pop up window with combo box will open. Select the link in the pop
up window that loads urls into the main window. If you want to know how to use remote control combo with frames, click Click here to learn remote control combo and frame.
Step 1:
To open a pop up window when you load this page,Use the following code.
<html>
<head>
<script language="JavaScript">
function pop()
{
var W1 = window.open('combo-eg.htm','Popup1',"toolbar=no,status=no,location=yes,
directories=no,menubar=no,scrollbars=yes,resizable=yes,width=160,height=160");
}
</script>
</head>
<body onload = " pop()" > When
you load this page a pop up window will open</body>
</html>
Step2:
Create a html page "combo-eg.htm".
<html>
<head>
<script language="JavaScript">
function loadurl()
{
window.opener.location=document.form2.example2.options[document.form2.example2.selectedIndex].value
}
</script>
</head>
<body>
<form name="form2">
<select
name="example2" size="1" onChange="loadurl()">
<option
selected value="http://www.yahoo.com">YAHOO</option>
<option
value="http://www.cnn.com">CNN</option>
<option
value="http://www.excite.com">EXCITE</option>
</select>
</form>
</body>
</html>
Remote control combo and frame:
If you want the link in the pop up window to open in particular
frame change the function
loadurl()
in combo-eg.htm.
function
loadurl()
{
opener.top.frames["frameName"].location=document.form2.example2.o
ptions[document.form2.example2.selectedIndex].value
}