[web] Buttons corrupt the address bar! Help!
I was using <input type="button" value="label" onclick="javascript:xxx" /> to launch javascript events in my page. It struck me that a better idea would be <button onclick="javascript:xxx">label</button> since the inputs didn't really belong to a form, and the proper buttons can be CSS'd.
There was one odd difference, though. When any button was clicked, now the address bar fills up with ?name=value&name=value... for all inputs on the page.
Why should this happen and how do I stop it?
Appearantly the browser is trying to submit a 'form', using a get-request.
I've tested it out, and it work fine in Explorer and FirefoxSo I have no idea what's going on.
But why not just use the input? Works in every browser and you can assign a css class to it or use the style attribute just fine.
I've tested it out, and it work fine in Explorer and FirefoxSo I have no idea what's going on.
But why not just use the input? Works in every browser and you can assign a css class to it or use the style attribute just fine.
Well, AFAIK inputs of type button can't contain other HTML such as images, and i'd have to type 'class="but"' or something for each of many buttons and I'd rather have a button{} entry in the .css.
It may well end up being the workable solution, but I'd still like to know why it's happening. They're not submit inputs.
It may well end up being the workable solution, but I'd still like to know why it's happening. They're not submit inputs.
Do you have any form tags lingering around on your page? Buttons often become a default form submit widget. And else try:
<button onclick="javascript:xxx; return false;">Label</button>
<button onclick="javascript:xxx; return false;">Label</button>
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement