Jump to content

Archived

This topic is now archived and is closed to further replies.

mayu_bt

ECHO "<SELECT ONCHANGE=\"WINDOW.OPEN(

Recommended Posts

Hi Learned people,

I am using the below syntax to have popup window popping up when I select the option in the dropdown.


echo "<select onchange=\"window.open('breaktype.php?username= ', 'Edituser', 'width=500,height=400,scrollbars=1')\">";

echo "<option>--Select--</option>";
echo "<option value='C'>Coffee</option>";
echo "<option value='F'>Fag</option>";
echo "<option value='L'>Lunch</option>";
echo "<option value='O'>Others</option>";
echo "</select>";

How to pass the value selected from the drop down to the popup in the above syntax? if I mention this.option it takes the valuse as "this.option" itself!! but not the value selected in the dropdown... PLEASE HELP....

POPUP window is popping up fine with the above syntax.. the problem is passing the value selected in the dropdown....

Share this post


Link to post
Share on other sites
You have a value, but no name to reference it as.. [=

Share this post


Link to post
Share on other sites
Create a js function:

[code]<script type="text/javascript">
function selectpops(a) {
    var value = a.selectedIndex.value;
    var win = window.open("breaktype.php?value=" + value, 'Edituser', 'width=500,height=400,scrollbars=1');
}
</script>

echo "<select onchange=\"selectpops(this)\">";

echo "<option>--Select--</option>";
echo "<option value='C'>Coffee</option>";
echo "<option value='F'>Fag</option>";
echo "<option value='L'>Lunch</option>";
echo "<option value='O'>Others</option>";
echo "</select>";[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=354118:date=Mar 12 2006, 07:29 AM:name=hitman6003)--][div class=\'quotetop\']QUOTE(hitman6003 @ Mar 12 2006, 07:29 AM) [snapback]354118[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Create a js function:

[code]<script type="text/javascript">
function selectpops(a) {
    var value = a.selectedIndex.value;
    var win = window.open("breaktype.php?value=" + value, 'Edituser', 'width=500,height=400,scrollbars=1');
}
</script>

echo "<select onchange=\"selectpops(this)\">";

echo "<option>--Select--</option>";
echo "<option value='C'>Coffee</option>";
echo "<option value='F'>Fag</option>";
echo "<option value='L'>Lunch</option>";
echo "<option value='O'>Others</option>";
echo "</select>";[/code]
[/quote]

Very good point hitman [=

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.