473,473 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

run 2 scripts when button clicked

TJS
trying to get 2 scripts to run when a button is clicked. The first is a
confirm which should only run the second script if true.
the problem is the second script doesn't run when "ok" is selected on the
confirm. What's wrong?

<INPUT TYPE="Image" src="../images/shop.gif" BORDER=0 TITLE="Continue
Shopping"
onclick="javascript: confirm('The selected items will be saved. \n Do you
wish to proceed?');
location.href='./cart.asp?action=save';">
Jul 23 '05 #1
3 1654
TJS wrote on 11 nov 2004 in comp.lang.javascript:
trying to get 2 scripts to run when a button is clicked. The first
is a confirm which should only run the second script if true.
the problem is the second script doesn't run when "ok" is selected on
the confirm. What's wrong?

<INPUT TYPE="Image" src="../images/shop.gif" BORDER=0 TITLE="Continue
Shopping"
onclick="javascript: confirm('The selected items will be saved. \n
Do you
wish to proceed?');
location.href='./cart.asp?action=save';">


1 this is only one script !

2 leave the "javascript:" out, superfluous.

3 leave the "./" out, superfluous.

4 try:

<script type="text/javascript">
tx = "The selected items will be saved.\nDo you wish to proceed?"
function conditionally(){
if(confirm(tx))
location.href='cart.asp?action=save';
}
</script>

<input
type="Image"
src="../images/shop.gif"
onclick="conditionally()"
style="cursor:pointer;">
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 23 '05 #2
TJS
thanks
Jul 23 '05 #3


hi

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #4

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

Similar topics

9
by: Mark | last post by:
I have a working PHP/MySQL application used for data entry. The data entry screen includes a "Save" button. The PHP code for this button looks like this: if (isset($_POST)) { if ($_POST ==...
8
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
2
by: Patrick | last post by:
i have the following .aspx file defined: ..... other tags here ... <asp:TableCell><asp:button id="AddButton" Runat="server" Text="Add New Vessel..."</asp:button></asp:TableCell> ..... other tags...
6
by: guoqi zheng | last post by:
In a regular html form, when user press "enter" key, the form will be submitted. However, in ASP.NET web form, a form will only be submitted (post back) when a special button is clicked. Many...
2
by: Rob Roberts | last post by:
Is there any way to prevent a ButtonField in a GridView from doing a postback when clicked? I want to use my own onclick handler to call window.open('SomePage.aspx') to display a page in a new...
13
by: Richard | last post by:
Hi All, The ASPX file below runs fine in ASP .NET WebMatrix 0.6 under WinXP/SP2 with IIS 5.1 and .NET Framework 1.0, 1.1 and 2.0. But if the last scriptString line is eliminated after...
11
by: bill | last post by:
I dynamically create buttons and associate them with an event using AddHandler. I want all the button events to fire at one time, when the page is posted, instead of when each button is clicked....
6
by: hemant.singh | last post by:
Hi all, I am trying to get a way by which I'll know exactly when user goes out of my site by clicking on close button in browser, So that w/e user click close button in browser, I can send a...
2
by: chitrapu | last post by:
hiii everybody, i have a little code that inserts the data into the databse. but the problem is the insertion should be peroformed only when a button is clicked. i have problems in this because i...
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...
1
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...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.