Back button (.net) generated not working

S

ShaneFowlkes

Somethinng odd is happening. I have a form button and on page load, I add a
javascript "back" function to this button. Like so:

btnCancel.Attributes.Add("onclick", "javascript:window.history.go(-1);")



<asp:Button ID="btnCancel" runat="server" Text="Cancel and go back." />



This generates the following html when rendered:

<input type="submit" name="btnCancel" value="Cancel and go back."
onclick="javascript:window.history.go(-1);" id="btnCancel" />

Yet, it doesn't work in IE6 or FF 1.5. Nothing happens. The page just
seems to post to itself. I've also tried changing the history.go value
to -2 and still get the same effect.

Any ideas? I'm using asp.net 2 (vb)

Thanks
 
J

Jeff Dillon

go?

and why test in an aspx page. A simple html test in the browswer, loaded
even from the local file system, would work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,814
Latest member
SpicetreeDigital

Latest Threads

Top