Jump to content

[SOLVED] Javascript as a Form action


Esqulax

Recommended Posts

Hiya

 

Im trying to open a pop up window when a button is clicked..the code i have works at the bottom as an <a href...>, but wont do is as a form action at the top...any idea what im doing wrong?

 


<table border="0" width="730" align="center" bgcolor="">
<tr>
	<td colspan="4" align="center">
		<img src="image/guest/guestmain.gif">
         </td>
         </tr>

<tr align="center">
<form method="post" action="javascript: window.open('add.php', 'Add Guest', 'width =400, height = 400');">
	<td><button value="Add Guest" type="submit"><img src="image/guest/addguest.png" width=40 height=40></button></td>
     </form>
    
<!-- Other table elements, removed for forum-->

	<tr align="center">
            <td><a href="javascript: window.open('add.php', 'Add Guest', 'width =400, height = 400');"><img src="image/guest/addimg.gif"></a></td>


	</tr>
        
  	</table>

</body>
</html>

Link to comment
Share on other sites

ok, you use the onSubmit event for doing something when the form is submited, but I have no idea why on earth you want to do it on form action, I mean why a form, the form is not going to post the values to you popup window.

 

Is it so you dont have to create a button.

here is the code

<form method="post" onSubmit="window.open('add.php', 'Add Guest', 'width =400, height = 400'); return false;" action="">
	<td><button value="Add Guest" type="submit"><img src="image/guest/addguest.png" width=40 height=40></button></td>
</form>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.