©ilj@flowsim.se
JavaScript code samples 24
JavaScript confirm
- displays a confirm dialog box with OK and cancel buttons
>>> this example in Swedish



Click
here
to show a
JavaScript confirm
!





 
And here is a way of writing it:
 
<A HREF="javascript:iljconfirm()" >Click here to show a JavaScript confirm dialog box</A>
 
Clicking the link calls the function iljconfirm() that displays the JavaScript confirm and then executes some other code if the user clicks the OK button. Put the function within SCRIPT tags in the HEAD portion of the document (see MINIMANUAL 1 basics).
 
<SCRIPT LANGUAGE="JavaScript"
TYPE="
text/javascript">
<!--
function iljconfirm()
{
if(confirm("If you choose OK youŽll get to the page about lastModified."))
{
window.location ='newpage.html'
//1
}
}
//
-->
</SCRIPT>
 
Put the text string (in italics here) on ONE line.
 
1 URL here, i e the same thing you would have put after
A HREF had you not used a confirm window
 


OTHER JAVASCRiPT EXAMPLES
 
How to use javascript to choose what image to show by selecting it in an option list
How to use javascript to switch images
How to use javascript to switch images onmouseover
JavaScript getDay() and document.write
JavaScript date
JavaScript timer
How to use javascript to switch images onmouseover
JavaScript timer
JavaScript onmouseover
JavaScript lastModified
JavaScript/ text in text area
JavaScript/ text in text area
how to open new windows in JavaScript
JavaScript clock
JavaScript confirm
JavaScript alert
JavaScript prompt
JavaScript onmouseover
JavaScript onmouseover2
JavaScript animation
JavaScript animation 2
 

 

Page by
ilj
ilj@flowsim.se
Last modified: December 12, 1997
This page should be part of a frames system
at:
http://www.flowsim.se
JAVASCRiPT