473,394 Members | 1,765 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Need help with button click and java code

i have a back button inside the code i have the following:

Response.Redirect("javascript:history.go(-1)");

I can't get the thing to work like i want it to, i want the user to click
the button and to return to whatever page they came from ...

i can have a link button that works with this: javascript:history.go(-1)

But i need a button instead of a link.

Also is there anyway to display a Yes / No dialog when a user hits a button
on a webpage?
May 7 '07 #1
4 4332
Artmic,

These things do not require a postback, you could just insert a html button
on your page (without runat="server" tag) similar to the following:

<input type="button" value="previous page" onclick="if (confirm('Are you
sure?')){history.back(1);}return false;" />

HTH

"ARTMIC" wrote:
i have a back button inside the code i have the following:

Response.Redirect("javascript:history.go(-1)");

I can't get the thing to work like i want it to, i want the user to click
the button and to return to whatever page they came from ...

i can have a link button that works with this: javascript:history.go(-1)

But i need a button instead of a link.

Also is there anyway to display a Yes / No dialog when a user hits a button
on a webpage?
May 7 '07 #2
Thanks for the info i will try it out, hopefully i will get it right.

"Sergey Poberezovskiy" wrote:
Artmic,

These things do not require a postback, you could just insert a html button
on your page (without runat="server" tag) similar to the following:

<input type="button" value="previous page" onclick="if (confirm('Are you
sure?')){history.back(1);}return false;" />

HTH

"ARTMIC" wrote:
i have a back button inside the code i have the following:

Response.Redirect("javascript:history.go(-1)");

I can't get the thing to work like i want it to, i want the user to click
the button and to return to whatever page they came from ...

i can have a link button that works with this: javascript:history.go(-1)

But i need a button instead of a link.

Also is there anyway to display a Yes / No dialog when a user hits a button
on a webpage?
May 7 '07 #3
HI,
i tried what you suggested, and it works for the input button .

The only problem is that i'm using the Infragistics controls, and the input
button does not look like one of theirs, got a whole Office type look to the
interface going.

Is there any way to do this without an input button type?
Is it possible to do this with a System.Web.UI.WebControls.Button object?
i guess not right?

"Sergey Poberezovskiy" wrote:
Artmic,

These things do not require a postback, you could just insert a html button
on your page (without runat="server" tag) similar to the following:

<input type="button" value="previous page" onclick="if (confirm('Are you
sure?')){history.back(1);}return false;" />

HTH

"ARTMIC" wrote:
i have a back button inside the code i have the following:

Response.Redirect("javascript:history.go(-1)");

I can't get the thing to work like i want it to, i want the user to click
the button and to return to whatever page they came from ...

i can have a link button that works with this: javascript:history.go(-1)

But i need a button instead of a link.

Also is there anyway to display a Yes / No dialog when a user hits a button
on a webpage?
May 7 '07 #4
Easy: just add the following code in Page_PreRender event:
C#:
MyAspButton.Attributes["onclick"] = "if (confirm('Are you
sure?')){history.back(1);}return false;";
VB:
MyAspButton.Attributes("onclick") = "if (confirm('Are you
sure?')){history.back(1);}return false;"

Please note "return false" added to the end - this is needed so that
standard postback does not get triggered.

HTH
"ARTMIC" wrote:
HI,
i tried what you suggested, and it works for the input button .

The only problem is that i'm using the Infragistics controls, and the input
button does not look like one of theirs, got a whole Office type look to the
interface going.

Is there any way to do this without an input button type?
Is it possible to do this with a System.Web.UI.WebControls.Button object?
i guess not right?

"Sergey Poberezovskiy" wrote:
Artmic,

These things do not require a postback, you could just insert a html button
on your page (without runat="server" tag) similar to the following:

<input type="button" value="previous page" onclick="if (confirm('Are you
sure?')){history.back(1);}return false;" />

HTH

"ARTMIC" wrote:
i have a back button inside the code i have the following:
>
Response.Redirect("javascript:history.go(-1)");
>
I can't get the thing to work like i want it to, i want the user to click
the button and to return to whatever page they came from ...
>
i can have a link button that works with this: javascript:history.go(-1)
>
But i need a button instead of a link.
>
Also is there anyway to display a Yes / No dialog when a user hits a button
on a webpage?
May 7 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Johnny Knoxville | last post by:
I've added a favicon to my site (http://lazyape.filetap.com/) which works fine if you add the site to favourites the normal way, but I have some JavaScript code on a couple of pages with a link,...
0
by: south622 | last post by:
I'm taking a beginning Java course and I'm stuck in week eight of a nine week course. If anyone could help me I would greatly appreciate it. This assignment was due yesterday and each day I go past...
1
by: klubbhead | last post by:
This part of my program needs to read from 4 parameter files and then displays them on the screen by clicking a different radio button. The program itself works, but my professor says that I have to...
2
by: lintas | last post by:
Hi All, I am using a java script function for opening a pop up window in a link button click. And I am able to call the function at link button's second click only. I am not able to call the...
4
by: AshishMishra16 | last post by:
HI friends, I am using the Flex to upload files to server. I m getting all the details about the file, but I m not able to upload it to Server. Here is the code i m using for both flex & for...
1
by: dishal | last post by:
Hi, Im having a problem with typing on the JPanel. The thing is, that it works perfectly fine when this line " content.add(jp, BorderLayout.NORTH); " is taken out (its the buttons panel) but when its...
1
by: twin2003 | last post by:
need help with inventory part 5 here is what I have to do Modify the Inventory Program by adding a button to the GUI that allows the user to move to the first item, the previous item, the next...
0
by: Ty | last post by:
I have a page that has three gridviews on it. In each gridview the first column is a link button representing a Database ID field. What I'm trying to accomplish is to email that page and click on...
18
by: wizdom | last post by:
Help - change text on click - text has another onclick inside with php variables ---------- I think what I'm trying to do is simple. I have a 2 buttons on a page. 1 button allows a thread of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.