< form name=form1>
<%
int  x = 0;
while ( x < 10)
{
%>
<label name="<%=x%>"> <input type=textbox name=inaki>

<br>
<%
x = x + 1;
}
%>
<input type=button value=go onclick="doit(this)">
</form>
<script>

function doit(sthg)
{
var x = 0;
while(  x < 100)
{
alert(document.form1.inaki[x].value);
x = x+1;
}
}
</script>

Very simple code. I am doing 10 textboxes. And to access it am using document.form1.inaki[x].value.. i am accessing each textbox.
but how can i access the lable name for each texbox.

Recommended Answers

All 2 Replies

plz help its urgent.The project is bigger, but am stuck at this point.

I am in fact reading from database, creating the label names based on it. And each label name i have textbox for it. I need to send the labels + textbox values together as parameters. I am basically using document.location.href in the function doit(sthg)..

if u just help me in doing that small sample. my whole big project is solved.

You can put an id attribute at the label tag and access it using:
document.getElementById

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.