Reputation: 41
I have a drop down list. I have links in each option, when user changes option I want to open new page in same tab. but here page opens in new tab.
<html>
<body>
<form name="opennew">
<select name="sites" id="sites">
<option value="" selected>Select Site</option>
<option value="http://www.yahoo.com">Yahoo!!!</option>
<option value="http://www.gmail.com">Gmail</option>
<option value="http://www.google.co.in">Google</option>
<option value="http://www.facebook.com">Facebook</option>
</select>
<input type="button" name="Submit" value="Go!" onClick="window.open(sites.value)">
</form>
</body>
</html>
Upvotes: 1
Views: 7421
Reputation: 2733
Add _parent
in onClick
like this:
onClick="window.open(sites.value, '_parent')"
The chosen site would be opened in parent frame which is the same window/tab.
Upvotes: 1