• Advertisement
Sign in to follow this  

[web] Buttons corrupt the address bar! Help!

This topic is 4653 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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>

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement