Solved

php & Javascript on OpenNewWindow

Posted on 2009-04-03
6
537 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

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…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

734 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