[Javascript] Pop up in javascript

Paul Novitski paul at dandemutande.org
Wed Mar 10 13:33:09 CST 2004


Sam,

Here's one way of doing what you want, using standard form submit methodology:

<script language="JavaScript">
function set(target) {
         if (confirm("Are you sure you want to delete?")){
                 document.forms[0].dispatch.value=target;
                 document.forms[0].submit();
                 // -OR-
                 document.location = "deletePage.html";
         }
}
</script>
...
<form action="deletePage.html" method=post>
<input name="dispatch" type=hidden>
<button onclick="set('delete');">Delete</button>
</form>

Paul


At 10:54 AM 3/10/2004, you wrote:
>Hi
>
>I want to show a pop up (delete confirmation in my page) when user clicks 
>on delete button.The pop up will show "Are you sure you want to delte-yes 
>or no"
>If user clicks on yes, then my page should set a page variable names 
>"dispatch" to "delete".ANd then call my form's post action, which will 
>route it to the next page...
>how do i accomplish these two tasks for the onlye one button click?
>Thanks in advance,
>Sam.
>
>My code below:
>
>
>
><SCRIPT LANGUAGE="JavaScript">
>
>function set(target) {document.forms[0].dispatch.value=target;}
>
></script>
>
><table border="1" width="100%">
>
><tr>
>
><th>
>
><html:submit onclick="set('delete');">Delete</html:submit>
>
>......
>
>
>
>so basically i want a pop up when user clicks the above Delete button 
>(struts uses <html:submit  to generate a HTML button) and when i click on 
>the yes on this pop up, i want the set(target) to get set
>
>Thanks in advance for help,
>
>Sam.
>
>
>Do you Yahoo!?
>Yahoo! Search - <http://search.yahoo.com/?fr=ad-mailsig-home>Find what 
>you're looking for faster.
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript





More information about the Javascript mailing list