|
Slide 11.e: JavaScript where to … (cont.) Home |
|
| You can create a variable with the var statement. Rules for variables include: |
|
strname is not the same as a variable named STRNAME!
<html><body> <script type="text/javascript"> var bool = confirm( "Go back to the previous page?" ); if ( bool == true ) { window.location = document.referrer; } else if ( bool == false ) { document.write ( "<a href='" + document.referrer + "'>Back</a>" ); } </script> </body></html> |
OK and Cancel buttons.
It returns true if the user chooses OK and false if the user chooses Cancel.