Welcome to WebmasterWorld Guest from 54.166.114.43

Forum Moderators: open

Message Too Old, No Replies

Javascript - prompt - using the "cancel" button

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

10+ Year Member



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]

6:09 pm on Jan 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> (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?

8:53 am on Jan 30, 2003 (gmt 0)

10+ Year Member



Could be a bit of both. But if I do another conditional statement it might work.
9:15 am on Jan 30, 2003 (gmt 0)

10+ Year Member



Thanks it works fine now.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month