How to open links generated from dropdown menus in a new window or tab
I've found a javascript that does exactly what it is supposed to do. The user chooses from 2 categories and based on these choices the user is linked to a specifik URL. However, it is crucial that these links open in a new window or tab - not in _self. Anyone who might help me out here - I've tried and tried but no luck yet.
<!DOCTYPE html>
<html>
<body>
<!-- DROP-DOWN NAVIGATION MENU - III -->
<!-- This goes in the HEAD of the html file -->
<script language="JavaScript" type="text/javascript">
<!-- Copyright 2001, Sandeep Gangadharan -->
<!-- For more free scripts go to (URL address blocked: See forum rules)/scripts/ -->
<!--
function tothePage() { // modify the script below to match your needs
if (document.drop.choice1.selectedIndex == 0 || document.drop.choice2.selectedIndex == 0) { return; }
<form name="drop">
<select name="choice1"> // you can add as many items in this drop down list as you want
<option selected value=0>Choose Product ...</option>
<option value=1>Free Script</option>
<option value=2>Free Program</option>
</select>
<select name="choice2"> // you can add as many items in this drop down list as you want
<option selected value=0>Choose Item ...</option>
<option value=1># 1</option>
<option value=2># 2</option>
<option value=3># 3</option>
</select>
<input type="button" value="Go!" onClick="tothePage()" />
</form>
Bookmarks