It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Closing A Pop Up Window

Closing A Pop Up Window

Postby NilesforMiles on Thu Aug 11, 2011 2:44 pm

Hello there.. I'm looking for some assistance in closing a pop up window which has a a submit button in it. What happens is I have a link on a site [url]http:www.cbchronicles.com[/url]which when the user clicks it (submit story) link, it opens a pop up window which has some general terms for the user to read.. once they've read it there is a check box to agree to the terms and then a submit button under that, when the submit button is hit a new page opens in the parent window revealing the content to the user.. The thing is the pop up window stays open and I would like it to close once the user checks the agree box and hits submit... Can anyone assist? I'm not that good with Javascript so I don't know where to take it from here... Here is what I am using so far : Thank you in advance!

Javascript in my php file:
Code: Select all
<!--Pop Up Terms Window-->
<SCRIPT TYPE="text/javascript">
<!--
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=400,height=200,scrollbars=yes');
return false;
}
//-->
</SCRIPT>


<!--Agree check box-->
<script language="javascript1.2">
function yes_no()
{
   var agree=document.Agree.agree.checked;
   if (agree == true){
      return true;
      

   }else{
      alert("you must agree to terms if you would like to submit a story");
      return false;
   }
}
</script>


<!--load page back in parent window-->
<script>
function loadinparent(url){
self.opener.location = url;

}
//-->
</SCRIPT>


And this is what I have for the agree check box and submit button in the pop up window.
Code: Select all
If you agree to the terms and conditions above please check the box below and press submit.
<form method="get" action="javascript:loadinparent('http://www.cbchronicles.com/submit-story.html', true)" onsubmit="return yes_no(this.form) "name="Agree">

<INPUT name="agree" name="agree" value="agree" type="checkbox"> I agree to terms <input type="submit" name="submit" value="Accept Terms"> </form>
NilesforMiles
 
Posts: 1
Joined: Thu Aug 11, 2011 1:54 am

Who is online

Users browsing this forum: No registered users and 3 guests