Solved

php & Javascript on OpenNewWindow

Posted on 2009-04-03
6
531 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 19

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 19

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 19

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 19

Accepted Solution

by:
NerdsOfTech earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mimic google as my ip 11 53
simplest php form 3 57
PHP - AJAX and MySQL it works only if the value is a number 12 33
How can I echo a PHP variable in AJAX function? 7 28
Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
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…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

914 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now