简体   繁体   中英

javascript pop-up box

OK so I haven't messed with JavaScript in a long time but I do remember some. I have tried Google but it hasn't proved to be what i wanted.

Let's say I have a link... when you click it -- a window pop-up box appears. You can submit the form... then when you press submit! The pop-up box with the form you just filled out would close and the page you clicked the box up box would be redirected....

How would I make that happen?

Try this:

Parent page:

<script type="text/javascript">
window.name="dansMainPage";
function popWin(link) {
  var w = window.open(link.href,link.target,'width=500,height=600,resizable');
  return w?false:true; // if popup blocker, use the default behaviour of the link
}
</script>
<a href="pagewithform.html" target="_blank"
onClick="return popWin(this)">Pop form</a>

child page:

<form target="dansMainPage" onSubmit="setTimeout(function() { window.close() },1000)">
.
.
.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM