Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Javascript Alert... help


Message #1 by "Jeff McFarland" <jeff@s...> on Wed, 16 Jan 2002 17:27:30
okay, your script should kind of look like this:
<SCRIPT LANGUAGE="JavaScript">
function confirm() {
var cnfrm = confirm("You are about to reset your form. \n \n Do you want to
continue?");
   if (cnfrm == true) {
   document.form.reset();
   }
}
</SCRIPT>
You can also add more options. The confirm returns 2 values : true and
false. you can do another if statement if you want something to happen if
they say no.
In confirm and prompt and alert statements, "\n" is a line break (basically
the <BR> tag in HTML).
If you want to do this in an external file, open up notepad and copy
everything except the <SCRIPT> tags into it. Then, rename it what you want
it named (with a .js extension) and put this into your HTML file:
<SCRIPT LANGUAGE="JavaScript" SRC="name_of_external_file.js">

> I would like to know how to create a js script that would act the
> following way:
>
> On my form, I have a reset button, if a user clicks the reset button, a js
> alert will be displaced saying " You are about to reset your form", if
> they click Yes, it resets the form, and if they click cancel.. nothing
> happens
>
> Can anyone help?



  Return to Index