File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes dynamic input field generation within the same page at defined location 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 "dynamic input field generation within the same page at defined location" Watch "dynamic input field generation within the same page at defined location" New topic
Author

dynamic input field generation within the same page at defined location

Ackshat Sharma
Greenhorn

Joined: Sep 03, 2011
Posts: 22
on writing a document.getElementById("id").innerHTML='<input type=\"number\" />';

inside a loop in a javascript function replaces every previous input box by the new one, so no matter the loop prints it n times but it is displayed only once i.e the last printed field

and document.writeln('<input type...>') in the loop prints n fields in a new basic display.

Can anyone here tell me how to dynamically display input fields within the same page at any desired location


Thanks.
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 516
Hello,
You need to concat the "'<input type=\"number\" />' " to existing innerHTML.
Hence it should be

innerHTML = innerHTML + new input field.


Regards,
Amit
Ackshat Sharma
Greenhorn

Joined: Sep 03, 2011
Posts: 22
Thanks Amit ,it was useful (and i am laughing on myself).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: dynamic input field generation within the same page at defined location