Quick References
ADO
ASP
CSS2
HTML
JavaScript
Jet SQL
VBScript
WML
WMLScript
WSH
XHTML
XML DOM
XSLT
Features
Knowledge Base
Tutorials
Partners
ZVON.ORG
XML
Planet Source Code
VisualBuilder
Web Design
Your HTML Source
XML/XSLT Forums
ASPAlliance
Scripts
Programmers Heaven
Tek-Tips Forums
Developer Fusion
Code Project
All Objects
Window Object
window.alert
window.prompt
METHOD: Window::confirm
confirm
("message")
This method brings up a dialog box that prompts the user to select either 'o.k.' or 'cancel', the first returning true and the latter, false.
The following example opens a new window, creates a button in the original window and assigns the closeWindow() function to its onClick event handler. This function prompts the user to confirm the closing of the new window.
Code:
<form action="" method="POST" id="myForm">
<input type="Button" name="" value="Close" id="myButton" onClick="closeWindow()">
<script type="" language="JavaScript">
myWindow = window.open("", "tinyWindow", 'toolbar, width=150, height=100')
function closeWindow() {
myWindow.document.write("Click 'O.K'. to close me and 'Cancel' to leave me open.")
if (confirm("Are you sure you want to close this window?")) {
myWindow.close()
}
}
</script>
</form>
Output:
Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information