Solved

php & Javascript on OpenNewWindow

Posted on 2009-04-03
6
530 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
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…
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.

708 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

15 Experts available now in Live!

Get 1:1 Help Now