»
EnglishFrenchVietnamese

Print - Open New Window Dropdown - JavaScriptBank.com

Full version: jsB@nk » Snippet » Open New Window Dropdown
URL: https://www.javascriptbank.com/open-new-window-dropdown.html

Open New Window Dropdown © JavaScriptBank.comYou can use this JavaScript to open a address in the new window.

Full version: jsB@nk » Snippet » Open New Window Dropdown
URL: https://www.javascriptbank.com/open-new-window-dropdown.html



JavaScript
<script language="JavaScript">function goThere(){ if (window.document.form_sites.select_sites.value.substring(0,7) == "http://" || window.document.form_sites.select_sites.value.substring(0,8) == "https://")    {       the_site = window.open(window.document.form_sites.select_sites.value)    } else    {     enterWebsite()    }}function enterWebsite(){ if (window.document.form_sites.select_sites.value == "other")    {      prompt_url = prompt("ENTER WEB ADDRESS","http://")    } if (prompt_url.substring(0,7) != "http://")   {    alert("PLEASE ADD THE  \"http://\" PREFIX")   } else   {    window.open(prompt_url,"the_window")     } while (prompt_url.substring(0,7) != "http://")   {    enterWebsite()   }}</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<form name="form_sites"><select name="select_sites" onchange="goThere()">  <option value="#">JavaScriptBank.com</option>  <option value="#">JavaScriptBank.com</option>  <option value="#">JavaScriptBank.com</option>  <option value="https://www.THIS IS IN CASE YOU WANT TO ADD A  WEBSITE ON A SECURE SERVER (SPECIFY THE SITE).com">ADD WEBSITE DESCRIPTION HERE</option>  <option value="other">Other...</option></select></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->