473,581 Members | 2,785 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help with button click and java code

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

Response.Redire ct("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:hist ory.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 4347
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?')){histor y.back(1);}retu rn false;" />

HTH

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

Response.Redire ct("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:hist ory.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?')){histor y.back(1);}retu rn false;" />

HTH

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

Response.Redire ct("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:hist ory.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.W ebControls.Butt on 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?')){histor y.back(1);}retu rn false;" />

HTH

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

Response.Redire ct("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:hist ory.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.Att ributes["onclick"] = "if (confirm('Are you
sure?')){histor y.back(1);}retu rn false;";
VB:
MyAspButton.Att ributes("onclic k") = "if (confirm('Are you
sure?')){histor y.back(1);}retu rn 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.W ebControls.Butt on 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?')){histor y.back(1);}retu rn false;" />

HTH

"ARTMIC" wrote:
i have a back button inside the code i have the following:
>
Response.Redire ct("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:hist ory.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
4212
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, which when you click it bookmarks the site (much easier). The favicon is never saved if the site is bookmarked this way. Does anyone have any ideas...
0
7103
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 the due date 10% of the grade is taken off. I think I'm coming down with the flu and my brain is just not processing this assignment. Here is the...
1
1493
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 improve the code in the DescriptionPanel 's listener because there are several lines of code that are identical and I should only have them once....
2
15499
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 java scritp at its first clic. Except this java script call, any thing i can do at first click itself. I have tried many alternatives..but no use...can...
4
6210
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 Struts: import java.io.File; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Enumeration; import java.util.Iterator;
1
2145
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 added back in, i simply cannot type! HELP!!!! Codes are as follow: import java.awt.*; import javax.swing.*; import java.awt.event.*;
1
2811
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 item, and the last item in the inventory. If the first item is displayed and the user clicks on the Previous button, the last item should display. If the...
0
1199
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 the link button to open the page. The problem. When I send the page to myself on the same PC that I am creating the site on and open the email...
18
7743
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 messages to be displayed, the other button collapses that same thread. Works fine. I was asked if I can just make it one button. I've played...
0
7876
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7804
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7910
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8180
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6563
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5366
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2307
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1409
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1144
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.