I need your help. This should be a simple-to-answer question. I want to modify a site to my needs and this is how far I got.
I have a formular
<form>
<div><select id="select1"><option>value x</option></select></div>
<div><select id="select2"><option>value x</option></select></div>
<div><input type="submit" name="submit" value="Submit changes"></div>
</form>
I want to check whether the value of the select-elements is equal or not. This should happen when I click the submit-button. If they are equal there should be a popup with text like: Are you sure this is right?
So I call the value of the selectfields with
function show_alert() {
var x = document.getElementById('select1').value;
var y = document.getElementById('select2').value;
//If the values are equal there should be an alert
if (x=y) {
alert ('Are you sure this is right?');
}
}
I guess that I should add an onClick-handler to the submit button like
<div><input type="submit" name="submit" value="Submit" onclick='show_alert()'></div>
How do I add this handler when I have no access to the site?
If there is anything wrong with my idea I'd be happy to hear your comment.
Thanks.