Rob
Rob

Reputation: 8101

Why won't my javascript open a new window?

<script type="text/javascript">window.open('timepop.php','window',width=400,height=200,left=0,top=100,screenX=0,screenY=100')</script>

When I put it into my browser as javascript:window.open('timepop.php','window',width=400,height=200,left=0,top=100,screenX=0,screenY=100') it works fine, but when placed into a live page, it doesnt.

Upvotes: 0

Views: 528

Answers (2)

Pekka
Pekka

Reputation: 449415

  • window might not be a good name for a popup window, it might conflict with the global window object (not sure though)

  • You are missing a quote in your third argument

  • Check whether the window gets caught by a pop-up blocker.

Upvotes: 4

Sarfraz
Sarfraz

Reputation: 382696

You are missing quote starting quote:

<script type="text/javascript">window.open('timepop.php','window',width=400,height=200,left=0,top=100,screenX=0,screenY=100')</script>
                                                  ================^

Try this:

<script type="text/javascript">window.open('timepop.php','window','width=400,height=200,left=0,top=100,screenX=0,screenY=100')</script>

Upvotes: 1

Related Questions