• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSP...dynamic text box crteation with JavaScript

 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all!
cld u pls tell me as to how to add on dyanmically textboxes whgen a user cliclk on a button..
i tried with document.write("Input type="...)
it went to a new documnet ...
pls help me out...
Menon
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even though you are using this in a JSP page, it's really a JavaScript problem, so I've moved it over to our HTML/JavaScript forum for you.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
document.write replaces all of the document...

you need to use something like this:



Eric
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want some parts of your form to appear only if user hits the button,
you might want to instead of creating them dinamicly, just play with "visisbility" attribute.



If you have a situation, when you need different elements appear at the same place, depending on what is clicked on a page, you can define hidden div's one for each set of elements, and then just use their innerHTML (or just use cloneNode and appendChild) to be included into right place on your page.
The following is very simple example of that. I tested it in IE, but it could be cross browser.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic