I'm currently using < select > tags and < option > tags each with their own value attributes and using it link to a new page.
This is my code:
<div class="label">
<label> Select your online bank login: </label>
<select id="selectBank">
<option value="https://ipn.paymentus.com/epd/stde/lhud"> Paymentus </option>
<option value="https://www12.bmo.com/onlinebanking/cgi-bin/netbnx/NBmain"> BMO </option>
<option value="https://www.myvisaaccount.com/Vancity_Consumer/Login.do"> Citizens' Bank of Canada </option>
<option value="https://bvi.bnc.ca/auth/Login"> National Bank of Canada </option>
</select>
<button onclick="goToBankLogin()"> Login </button>
and this is the javascript code for selecting values, right now it opens into a new page:
function goToBankLogin() {
var selectedBank = selectBank.options[selectBank.options.selectedIndex].value;
window.location.replace(selectedBank.toString());
}
and i need it to open to a new tab, how would i do this?
Okay, just playing around and figured this out, it works for me and opens up a new tab
changed up my function a bit:
function goToBankLogin() {
var selectedBank = selectBank.options[selectBank.options.selectedIndex].value;
window.open(selectedBank.toString());
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.