Solved

php & Javascript on OpenNewWindow

Posted on 2009-04-03
6
533 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
Email called spam 5 36
php help 34 58
MVC - procedural PHP 10 35
Extracting content from meta tag PHP MYHTML DOM 3 20
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
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 count occurrences of each item in an array.

860 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