javascript - Dropdown Menu - Open Link in Parent Window -


i have code below in pop window, open in parent window if possible.

javascript:

var geturl = function () {     var option1 = document.getelementbyid('dropdown1').value;     var option2 = document.getelementbyid('dropdown2').value;     var url = 'http://www.domain.com/' + option1 + '/' + option2;     location.href = (url); } 

html:

<select id="dropdown1">     <option value="1">1</option>     <option value="2">2</option> </select> <select id="dropdown2">     <option value="1">1</option>     <option value="2">2</option> </select> <button onclick="geturl()">run</button> 

the code works fine opens in current window.

any great :) thanks

try below js open page in new window instead of location.href=(url).

window.open(url,"_blank"); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -