Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

php & Javascript on OpenNewWindow

Posted on 2009-04-03
6
Medium Priority
?
541 Views
Last Modified: 2013-12-12
I have this code and all I get is an error not sure how to fix.

I have the folloowing script on the <head>
<script type="text/javascript">
<!-- // ONW = Open New Window
function ONW(url, name, bits) {
newWin=window.open(url, name, bits);
newWin.focus();
}
// -->
</script>

Then on <body>

<form action="<a href='javascript:ONW('pPrintSample.php' id='PrintSample' method='post' onsubmit='return confirm('Are you sure you want to coninue?')','PrintWindow', 'width=900,height=600,left=30,top=30,location=no,menubar=no,resizable=no,status=no,scrollbars=no,toolbar=no')'></a>">

I need two things display the alert Are you sure... and if the press OK then open the page on a new window"

Thanks
Rafael
0
Comment
Question by:rcleon
  • 4
  • 2
6 Comments
 
LVL 20

Expert Comment

by:NerdsOfTech
ID: 24063430
you are missing two parameters: name and bits in your function
0
 

Author Comment

by:rcleon
ID: 24063459
It works by it self, beside the name is PrintWindow the bits are the on/off for the rest of the parameters. But thanks it made me look twice, I do appriciate.
Rafael
0
 
LVL 20

Expert Comment

by:NerdsOfTech
ID: 24063479
You meant maybe:
<form action="" id="PrintSample" method="post" onsubmit="return confirm('Are you sure you want to coninue?'); ">
 
<a href='javascript:ONW('pPrintSample.php', 'PrintWindow', 'width=900,height=600,left=30,top=30,location=no,menubar=no,resizable=no,status=no,scrollbars=no,toolbar=no')">Click Here</a>

Open in new window

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 20

Expert Comment

by:NerdsOfTech
ID: 24063505
Corrected syntax.

Before your form was mixed in your action parameter.

are you submitting to form anywhere; what page?
<form action="" id="PrintSample" method="post" onsubmit="return confirm('Are you sure you want to coninue?'); ">
 
<a href='javascript:ONW('pPrintSample.php', 'PrintWindow', 'width=900,height=600,left=30,top=30,location=no,menubar=no,resizable=no,status=no,scrollbars=no,toolbar=no');">Click Here</a>

Open in new window

0
 
LVL 20

Accepted Solution

by:
NerdsOfTech earned 2000 total points
ID: 24063517
corrected again :)
<form action="" id="PrintSample" method="post" onsubmit="return confirm('Are you sure you want to coninue?'); ">
 
<a href="javascript:ONW('pPrintSample.php', 'PrintWindow', 'width=900,height=600,left=30,top=30,location=no,menubar=no,resizable=no,status=no,scrollbars=no,toolbar=no');">Click Here</a>

Open in new window

0
 

Author Closing Comment

by:rcleon
ID: 31566403
Thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question