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
Post a Comment