Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

target="_blank" attribute in form tag

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
like
scrollbar="no",
menubar="no"
left=200
top=200
width
hight
extra.............
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
thanks
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This should work for your first question. I use it frequently.
function doWindow() {
someWin = window.open("","win1","width=780,height=520,scrollbars=yes,resizable=yes,menubar=no,statusbar=yes");
document.printForm.submit();
}
....
<form name="printForm" action="something.html" target="win1" method="post">
<input type="text" name="text1" value="">
<input type="button value="Click me!" onClick="doWindow()">
</form>
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic