Exclamation Javascript problem with submit buttons placed close to each other
Please have a look at the page here. Below is a screenshot where the problem lies:
As you can see, there are two buttons which have been called by a javascript here. Both have been coded to redirect to different pages. However, when I hover my mouse on the Regret button it automatically highlights both buttons and when I click regret it redirects to the page where the Confirm button is supposed to redirect. The Confirm button itself is working fine and taking me to the desired page.
Can’t figure out where the problem is with the Regret button. Any help will be much appreciated. Basically each button should redirect only to where it is supposed to as I’ve specified in the Javascript code.
lets see some code! what do you mean “hover”-what does hover have to do with anything? surely you’re not using onhover for user input of a button…
it shouldn’t be more complicated than
<input type=button onclick(window.location.href = new location) /> for each button set to different “new locations”
This isn’t a javascript issue but a HTML issue, in your source you have a label that wraps both the text and input buttons. If this remove this label it will work normally.
<label class="formFieldQuestion"><h3>I would like to <input type="button" onclick="document.location = 'http://audiquattrofinal.tigersportsmarketing.com/attending/index.html';" value="Confirm"> / <input type="button" onclick="document.location = 'thankyou.html';" value="Regret"> my participation in the Audi quattro Cup 2011 - India Finals</h3></label>
His HTML is wrapped by a label element which by default gets event handlers set by the browser and anything inside it gets rendered useless unless you absolutely position it on the page.
Thanks a ton I removed the label class and its working fine now! I was going mad trying to figure out what went wrong
Actually yes the hover has nothing to do with it. But I noticed that when you hover the mouse on a button there is a light blue highlight on it. Now when I was hovering the mouse on the “Regret” button it was highlighting both the buttons instead of one. Now its been resolved and only the relevant button is being highlighted on hover. Phew