What's new
HTML Forums | An HTML and CSS Coding Community

Welcome to HTMLForums; home of web development discussion! Please sign in or register your free account to get involved. Once registered you will be able to connect with other members, send and receive private messages, reply to topics and create your very own. Our registration process is hassle-free and takes no time at all!

Open in new window

I want to open my next file in a new window.
my code is
print("<form name='ReportsForm'action='window.open(HA_RptAcctStmt.php)' method='POST' onsubmit='return formcheck(ReportsForm)'>");}
It doesn't work but it seems to me it worked in the past.
Is there something wrong with action='window.open(HA_RptAcctStmt.php)'
The action attribute in the <form> tag is meant to specify where the form data should be sent after submission. It's not meant for JavaScript. What you're trying to do with the window.open() method should be in a JavaScript function, not inside the action attribute.

Here's a quick fix for ya:

Remove the window.open from the action attribute.
Add an event listener in your JavaScript to handle the form submission, and there you can pop the new window.

Here's how you can modify your code:

function openNewWindowAndSubmitForm() {
window.open('HA_RptAcctStmt.php', '_blank');
return false; // prevent the default form submission

<form name='ReportsForm' action='HA_RptAcctStmt.php' method='POST' onsubmit='return openNewWindowAndSubmitForm();'>