![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Web Design & Programming Discussion of web design, and server-side & client-side scripting |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Jan 2007
Posts: 108
OS: window XP
|
Javascript Yes No popup windows
I have a form and when user click on the submit button, a javascript windows will pop up. User can choose yes or no. When click yes, the pop up will close and submit the form and if click no, just close the pop up window.
I know some basic how to create a pop up windows, but just does not know how to make it when click yes, will submit form! I think need to return value true to the form, so the form action will start! Could someone help me? Thank in advance. HTML Code:
<form name="form1" method="post" action="process.php" onSubmit=""> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </form> Last edited by peterjcs; 04-25-2008 at 07:36 PM. |
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,884
OS: Vista, various linux distros
|
Re: Javascript Yes No popup windows
Hey, you can take a look here for the type of box you are looking for and how to use it:
http://www.tizag.com/javascriptT/javascriptconfirm.php I think what you want to do is something along the lines of this: Code:
<form ... onSubmit="return confirm('do you want to submit the data?');" ...>
Hope it helps, Jamey |
|
|
|
|
|
#3 (permalink) |
|
Registered User
Join Date: Jan 2007
Posts: 108
OS: window XP
|
Re: Javascript Yes No popup windows
Thank for your reply. But i want to pop up a window. When user click the yes button on pop up windows, then the pop up windows will return true and submit the form.
How to return true to the main form? Is it possible using the javascript opener? |
|
|
|
|
|
#4 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,884
OS: Vista, various linux distros
|
Re: Javascript Yes No popup windows
oh, so you're going to open a pop-up with yes/no button elements inside, and then act upon that? To be honest i don't know, you may get better help on the javascript part of this forum: www.webdeveloper.com
|
|
|
|
|
|
#5 (permalink) |
|
Registered User
Join Date: Jan 2007
Posts: 108
OS: window XP
|
Re: Javascript Yes No popup windows
Hai, I finally found the way to do it. But any comment or improvement to the code is appreciated.
Below is the sample: HTML Code:
<html> <head> <title>Untitled Document</title> <script> function confirm(url) { window.open(url, "test", "width=200,height=20"); } </script> </head> <body> <form name="form1" method="post" action="submit.html"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><input type="button" name="Button" value="Button" onClick="confirm('test.html')"></td> </tr> </table> </form> </body> </html> HTML Code:
<html> <head> <title>Untitled Document</title> <script> function submitform(){ window.close(); opener.document.forms['form1'].submit(); } </script> </head> <body> <p> </p> <div align="center"> <input type="button" name="Button" value="Yes" onClick="submitform();"> <input type="button" name="Submit2" value="No" onClick="window.close()"> </div> </body> </html> HTML Code:
<html> <head> <title>Untitled Document</title> </head> <body> submit successfully. </body> </html> |
|
|
|
![]() |
| Thread Tools | |
|
|