homepage Welcome to WebmasterWorld Guest from 54.211.219.178
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
fintan




msg:1484559
 4:40 pm on Jan 29, 2003 (gmt 0)

Hi
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()
{
//variables
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
//variables

//conditional statments
if(checkbox == true)
{
//Your call has been closed
(confirm(closedcall))
window.open('http://example.com/helpdesk/email/closedcall.asp?
callID=<%=(rsEmail.Fields.Item("callID").Value)%>','','width=270,height=100',
'top=500,left=500');
}

else if(checkbox == false)
{
//Notify the user of call progress
(confirm (emailnotice))
window.open('http://example.com/helpdesk/email/emailnotice.asp?
callID=<%=(rsEmail.Fields.Item("callID").Value)%>','','width=270,height=100',
'top=500,left=500');
}

else(email == false)
{
//Do Nothing
}

//conditional statments end
}
//-->
</script>

<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.
Thanks

fintan.

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

 

hutcheson




msg:1484560
 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?

fintan




msg:1484561
 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.

fintan




msg:1484562
 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