Click here to Skip to main content
15,914,500 members
Home / Discussions / Web Development
   

Web Development

 
GeneralConfirm box's title Pin
Brendan Vogt13-Feb-08 2:29
Brendan Vogt13-Feb-08 2:29 
GeneralRe: Confirm box's title Pin
led mike13-Feb-08 13:26
led mike13-Feb-08 13:26 
GeneralRe: Confirm box's title Pin
keyboard warrior14-Feb-08 7:23
keyboard warrior14-Feb-08 7:23 
GeneralRe: Confirm box's title Pin
Johnny ²13-Feb-08 17:21
Johnny ²13-Feb-08 17:21 
GeneralRe: Confirm box's title Pin
Shog914-Feb-08 4:02
sitebuilderShog914-Feb-08 4:02 
QuestionCalling/firing/triggering an event from a button click Pin
Brendan Vogt13-Feb-08 0:46
Brendan Vogt13-Feb-08 0:46 
GeneralRe: Calling/firing/triggering an event from a button click Pin
Paddy Boyd13-Feb-08 5:01
Paddy Boyd13-Feb-08 5:01 
Questiononbeforeunload firing twice Pin
Brendan Vogt12-Feb-08 23:24
Brendan Vogt12-Feb-08 23:24 
Hi,

Below is the code of my body tag. The checkForChange method is called twice, why is this? I only need it to be called once. What it needs to do is to check if a textbox was changed, if so then it must display a message, but the message needs to be displayed if the user wants to go to another page if data was changed.

<body onbeforeunload="checkForChange();" >
<input type="text" onchange="isDirty = true;" />
<input type="submit" name="btnCancel" value="Cancel" id="btnCancel" onclick="return checkForChange();" />
<br /><br /><br /><br />
<a href="Link.htm">LinkLinkLinkLinkLinkLinkLinkLink</a>

<script language="javascript" type="text/javascript">
var isDirty = false;
function checkForChange()
{
if (isDirty)
return confirm('Changes have been made.');
else
return true;
}
</script>

</body>

If the user clicks cancel, it should stay on the current page, but if it clicks ok, then it should move to the next page. Currently the massge boz is displayed twice, and it doesn't matter what is clicked it still goes to the next page (on the link that was clicked).

Please can someone help.

Thanks
Brendan

<div class="ForumMod">modified on Wednesday, February 13, 2008 5:35 AM</div>
GeneralRe: onbeforeunload firing twice Pin
Ioan Anton14-Feb-08 10:33
Ioan Anton14-Feb-08 10:33 
QuestionHelp required please: Document Upload and Email Verification Pin
Freeweight12-Feb-08 6:14
Freeweight12-Feb-08 6:14 
GeneralRe: Help required please: Document Upload and Email Verification Pin
Steve Westbrook12-Feb-08 9:53
Steve Westbrook12-Feb-08 9:53 
Generalgenerating reports and exporting to .xls, .pdf and word Pin
livez12-Feb-08 4:24
livez12-Feb-08 4:24 
GeneralRe: generating reports and exporting to .xls, .pdf and word Pin
Paddy Boyd12-Feb-08 4:31
Paddy Boyd12-Feb-08 4:31 
GeneralRe: generating reports and exporting to .xls, .pdf and word Pin
livez12-Feb-08 20:15
livez12-Feb-08 20:15 
GeneralCannot use a leading .. to exit above the top directory. Pin
acodman12-Feb-08 3:29
acodman12-Feb-08 3:29 
GeneralRe: Cannot use a leading .. to exit above the top directory. Pin
andyharman12-Feb-08 7:47
professionalandyharman12-Feb-08 7:47 
GeneralRe: Cannot use a leading .. to exit above the top directory. Pin
Expert Coming13-Feb-08 4:56
Expert Coming13-Feb-08 4:56 
QuestionConfirming When Exiting Without Saving Pin
Brendan Vogt12-Feb-08 0:28
Brendan Vogt12-Feb-08 0:28 
GeneralRe: Confirming When Exiting Without Saving Pin
dfz12-Feb-08 2:03
dfz12-Feb-08 2:03 
QuestionRe: Confirming When Exiting Without Saving Pin
Brendan Vogt12-Feb-08 22:00
Brendan Vogt12-Feb-08 22:00 
GeneralRe: Confirming When Exiting Without Saving Pin
dfz13-Feb-08 2:51
dfz13-Feb-08 2:51 
GeneralWhats the difference javascript Pin
Cape Town Developer11-Feb-08 23:33
Cape Town Developer11-Feb-08 23:33 
GeneralRe: Whats the difference javascript Pin
Christian Graus11-Feb-08 23:42
protectorChristian Graus11-Feb-08 23:42 
GeneralRe: Whats the difference javascript Pin
Cape Town Developer11-Feb-08 23:43
Cape Town Developer11-Feb-08 23:43 
GeneralRe: Whats the difference javascript Pin
Cape Town Developer11-Feb-08 23:43
Cape Town Developer11-Feb-08 23:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.