Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to create dynamic Textbox in JSP

843840Jan 21 2009 — edited Jan 21 2009
I created dynamic Textboxes using javascript in JSP.But i want to give every textbox a unique name..But I dont know how to give unique name to all the textbox which are created dynamically.....Can u help me Please.............
<script code="text/javascript">

function dynam(val)
{
var d= document.getElementById("Bottom");
d.innerHTML='<table>';
for(i=1;i<=val;i++)
{
d.innerHTML += '<tr><td>Parameter</td><td><INPUT type="text" name="week"'+i+'size = 15></td>';
}
d.innerHTML +='</table>' ;
}

</script>
in the above code."val" is the integer value passed while calling this function. "Bottom" is the id of <DIV> tag in my JSP page.

My problem is : when i creating a text box. the Unique name of the textbox in not getting generated.All the text bok has the same name as "week",but i want the name to be as week1,week2,week3,.....etc

Edited by: AnilTcs on Jan 21, 2009 1:31 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 18 2009
Added on Jan 21 2009
2 comments
965 views