Hi,
i have a following form.
-
<form id="frm_signup">
-
<b>please fill the following registration form.All the fields are compulsory</b><br/><br/>
-
-
<table border="0" cellpadding="" cellspacing="" id="register-table">
-
-
<tr>
-
<td >Username</td><td>:<span style="color:#FF0066">*</span></td>
-
<td id="username_row" ><input type=text id="username" name="username" value="" />
-
<div class="er_msg"></div></td>
-
</tr>
-
-
<tr>
-
<td >Password</td><td>:<span style="color:#FF0066">*</span></td>
-
<td id="pword_row" ><input type="password" id="pword" name="pword" value="" />
-
<div class="er_msg"></div></td></tr>
-
</table>
-
<input type="button" id="onRegister" onclick="onRegister()"/>
-
</form>
-
during validation if username field is empty i want to display error msg in the
div tag corresponding to username row.
so how can i display the msg in username's div tag.
if i use document.getElementById, then the same msg will display for username and password and whereever the div tag appears.
i don't want to use seperate id for each div for each input field.
i got this piece of code from
www.adbrite.com sites registration form(under advertisers tab, while asking personal details).
i think the following piece of code can apply to my problem
-
function onRegister()
-
{
-
MYTABLE=document.getElementById('register-table');
-
for (i=0;i<MYTABLE.rows.length;i++) {
-
-
//MYTABLE.rows[i].div.innerHTML="enter value";
-
alert(MYTABLE.rows[i]);
-
}
-
can any one think on those lines
can anyone help me pls....