tags:

views:

18

answers:

2

I have a form and i have the input values say google microsoft

On selection of the input value google i want to open a new google page in the new window. how i can get that.

+1  A: 

you should add an "onchange" event to the input field

<script type="text/javascript">
<!--
function onChangeExample(){
window.location = "http://www.google.com/"
}
//-->
</script>

<input type="text"  id="example" onchange="onChangeExample()">
Dani Cricco
does not open a new window.
lincolnk
+1  A: 

HTML code:

<html>
<body>
    <script>
    function openAnotherWin(combo) {
        var v = combo.value;
        window.open(v);
    }
    </script>
    <select name="sites" onchange="openAnotherWin(this)">
        <option value="">Select one site...</option>
        <option value="http://www.google.com"&gt;Google&lt;/option&gt;
        <option value="http://www.microsoft.com"&gt;Microsoft&lt;/option&gt;
    </select>
</body>
</html>

Test site: http://jsfiddle.net/JU4p3/

Protron