You are not logged in.
Pages: 1
In an html list as the example bellow. Can I add a button to open the selected page? I know about the onchange event. I want to do it after pressing a button.
<!DOCTYPE html>
<html>
<body>
<h1>Select</h1>
<br>
<form>
<select name="Choose">
<option value="https://.....">One</option>
<option value="https://.....">Two</option>
</select>
</form>
</body>
</html>
Γίνε ρεαλιστής, μείνε ονειροπόλος ...
Offline
In the button handler:
var sel = document.getElementById('yourselectid');
var url = sel.options[sel.selectedIndex].value;
window.open(url); // or: window.location = url;
Last edited by Trilby (2022-10-18 16:06:53)
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
Thanks you!
Γίνε ρεαλιστής, μείνε ονειροπόλος ...
Offline
Pages: 1