homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Javascript - prompt - using the "cancel" button

10+ Year Member

Msg#: 273 posted 4:40 pm on Jan 29, 2003 (gmt 0)

I'm trying to use the cancel button to cancel two prompt boxes so that no action is taken and the form will be submited without interferrence from the prompts.
Here is what I got so far.

<script language="JavaScript1.2" type="text/JavaScript">
function email()
var closedcall = "Do you want to notify the user that there call has been closed"
var emailnotice = "Do you want to email the user.";
var checkbox = document.form1.call_cleared.checked

//conditional statments
if(checkbox == true)
//Your call has been closed

else if(checkbox == false)
//Notify the user of call progress
(confirm (emailnotice))

else(email == false)
//Do Nothing

//conditional statments end

<input type="submit" name="Submit" value="Update" onClick="javascript: email()">

Bassically it comes down to if checkbox is check prompt and if its not prompt. Now here the part where I get stuck. If cancel is clicked do nothing.

What happens is it carries out the action anyway. Is there anyway to manipulate the cancel button so it won't open the window.


[edited by: tedster at 9:34 pm (utc) on Jan. 29, 2003]
[edit reason] stop side scroll [/edit]



WebmasterWorld Senior Member 10+ Year Member

Msg#: 273 posted 6:09 pm on Jan 29, 2003 (gmt 0)

> (confirm (emailnotice))
> window.open

something like

if (confirm(...)) {
window.open(...) }

would introduce the element of conditionality into the window open. Was that the question or am I just responding to a careless typo?


10+ Year Member

Msg#: 273 posted 8:53 am on Jan 30, 2003 (gmt 0)

Could be a bit of both. But if I do another conditional statement it might work.


10+ Year Member

Msg#: 273 posted 9:15 am on Jan 30, 2003 (gmt 0)

Thanks it works fine now.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved