permaculture playing cards
The moose likes HTML, CSS and JavaScript and the fly likes target= Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "target="_blank" attribute in form tag" Watch "target="_blank" attribute in form tag" New topic

target="_blank" attribute in form tag

kashif iftikhar
Ranch Hand

Joined: Aug 21, 2001
Posts: 43
in the form tag there is a attribute "target" its values are _blank,_self extra.....
when we give _blank value it open action page in new window.
my question is can we set that new window attributes.
if yes please tell me.
my second problem is also related to this one.
i have a form like this.
<form action=page1.jsp target="_blank" name="drive" method="post">
<input type="text" name="products" value="shirts">
<input type"submit" name="submit1" value="delete" onClick='drive.action="thisPAge.jsp">
<input type"submit" name="submit2" value="properties" onClick='drive.action="newWindowPage.jsp">
when i click any of the submit button it open action page in new window which it should.
but i want that when i click first button(submit1) it must open requested page in same window and when i click second button(submit2) it must open it in new window with attributes that i write in first question.
what change should i make in this form
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4351

I dont know on your first question.
On your second question, change one of your inputs from type=submit to type=button and use a onclick event handler.
also sometimes you can use two forms. but i think you need to change one to type=button
Dont blindly believe everything I say.

Visit my download page
Aaron Webb

Joined: Aug 16, 2001
Posts: 17
This should work for your first question. I use it frequently.
function doWindow() {
someWin ="","win1","width=780,height=520,scrollbars=yes,resizable=yes,menubar=no,statusbar=yes");
<form name="printForm" action="something.html" target="win1" method="post">
<input type="text" name="text1" value="">
<input type="button value="Click me!" onClick="doWindow()">
When the button is pressed it will open the new window and then call the submit method of the form and the form will submit to the new opened window based on the target attribute.
I agree. Here's the link:
subject: target="_blank" attribute in form tag
It's not a secret anymore!