Browser goes to another page on DOM script



I’m not totally sure how to describe this, but I’ll do my best. In any browser other than Internet Explorer whenever I use DOM to append something to the page, the browser like “goes forward.” It doesn’t seem to refresh the page though, it just like takes it to the same page again. I was able to fix this in many of my scripts by adding a history(-1) if the browser was anything other than Internet Explorer. But now I found a problem when I have a button that adds a line of text into a form field. When that button is clicked in any other browser it for some reason adds the content and then immediately submits the form! I don’t see why the script would do that. It is just a simple script saying document.getElementById("formfield").value += "my line of text"; I don’t understand why the other browsers keep doing this. How do I fix it?


I sincerely doubt that the problem actually has to do with altering the value. You neglected to include a test case - I whipped one up based on the BUTTON element. Needless to say I am not able to duplicate the problem you are experiencing.

push button test case

:cool: -//- One-time [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7


Oops, sorry I forgot to include a link. As soon as I added the type attribute in my code it stopped doing it. So my best guess is that if there is no type assigned to the button tag that it defaults to “submit.” But I didn’t know the type attribute was required on a button. Thanks a lot for your help.