When a visitor clicks a button element, how can I change the URL?
Example:
<form id="search">
<input type="text" />
<button onclick="javascript:alert('hi');">Alert Hi</button>
<button onclick="javascript:window.location.href='http://www.google.com/'">Go to Google</button>
</form>
For a quick demo page, I just need to send the visitor to a new URL when they click a button. I can execute JavaScript onclick (in the Alert Hi button), and the URL changes if I execute window.location.href='http://www.google.com/'
from Firebug's console. What do I need to do to change the URL on a button click?
X-frame-options
– Charlena