Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9010859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:34:33+00:00 2026-06-16T02:34:33+00:00

I have a javascript popup window on several pages of my website. I used

  • 0

I have a javascript popup window on several pages of my website. I used the a centered popup window I found on Center a popup window on screen?

function popupwindow(url, title, w, h) {
    var left = (screen.width/2)-(w/2);
    var top = (screen.height/2)-(h/2);
    return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}

This popup window works on some pages, but not on other pages…

I made 2 pages to show, on the first page the popup works
http://www.weddingpages.nl/test1.php
and on the second page the popup doesn’t work:
http://www.weddingpages.nl/test2.php

The source of the pages is exactly the same (copy, paste), only on the second page I deleted the form.

So if I understand correctly, this popup JavaScript only works when there is also a form on the page?

Here is the code of the page where the popup works:

<!DOCTYPE html>
<html>
    <head>
        <title>test1</title> 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

        <script type="text/javascript">
            function popupwindow(url, title, w, h) {
                var left = (screen.width/2)-(w/2);
                var top = (screen.height/2)-(h/2);
                return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
            }
        </script>
    </head>
    <body>
        <form class="form-horizontal" action="" method="post">
            <div class="control-group">
                <label class="control-label" for="title">Naam website / bedrijf:</label>
                <div class="controls">
                    <input type="text" class="span3" id="title" name="title" placeholder="Naam website / bedrijf">
                </div>
            </div>
            <div class="control-group">
                <div class="controls">
                    <button type="submit" name="submit" class="btn">Gegevens opslaan</button>
                </div>
            </div>
        </form> 
        <a href="javascript:popupwindow('http://www.google.com/', title, 1400, 700)">centered Pop up window</a> 
    </body>
</html>

So if you delete the form, the javascript stops working.

Is there anybody who can tell me why ? I am trying to find the solution already for almost 2 days 🙁

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T02:34:34+00:00Added an answer on June 16, 2026 at 2:34 am

    You don’t have defined “title” params befor pass it to function.
    try to change this:

    <a href="javascript:popupwindow('http://www.google.com/', title, 1400, 700)">centered Pop up window</a> 
    

    with this

    <a href="javascript:popupwindow('http://www.google.com/', 'real title', 1400, 700)">centered Pop up window</a> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have javascript code to open a popup window using the window.open() function. I'd
I am opening a Javascript popup window using window.open() function and have close button
I have a javascript popUp function... popUp(title, body){ $('body').append('<div id=popupWindow><div class=close></div> <h2 class=title>'+title+'</h2> <div
hello i have js file for the popup window. i have used in asp.net
I have a javascript window.open popup, and I want the popup to close itself
I have a javascript window.open popup, and I want to prevent popup from getting
I have opend a popup window using javascript. now in that popup window i
I have a website that contains a youtube video. I have a popup window
I have a web app which opens a new popup window with JavaScript and
I have used JavaScript on body onload event I used this code: function timeMsg()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.