Reputation: 17
Html code:
<body>
<h1>Select the country you want to know about</h1>
<br>
<form>
<select name="Countries and its Name" onchange="location = this.value;">
<option selected>---Select---</option>
<option value="india.html">India</option>
<option value="usa.html">United States of America</option>
</select>
</form>
</body>
I am only able to open it in the same tab, but how to open in a new tab?
Upvotes: 0
Views: 2621
Reputation: 43156
You can open a new tab programmatically usingwindow.open()
method by passing _blank
as window name.
<h1>Select the country you want to know about</h1>
<br>
<form>
<select name="Countries and its Name" onchange="window.open(this.value, '_blank')">
<option selected>---Select---</option>
<option value="india.html">India</option>
<option value="usa.html">United States of America</option>
</select>
</form>
Upvotes: 2