|
-
Jul 3rd, 2003, 09:09 AM
#1
Thread Starter
Lively Member
javascript: getting html label values
Hi there
I am using a checkbox and a corresponding label. When the user checks the checkbox I want to be able to retrieve the corresponding label value. How do I do this.
Here is the relevant portion of my code
<td>
<input type = "checkbox" name = "checkuser" id= "checkuser" value = "userid" onClick = "getname()">
</td>
<td>
<label for = "checkuser">usersurname, usersurname <label>
</td>
thanks
langals
-
Jul 3rd, 2003, 06:54 PM
#2
Fanatic Member
Here is an example:
Code:
<script language="JavaScript">
function getname(chk){
alert(chk.value);
}
</script>
<form name="LabelClicker">
<input type = "checkbox" name = "checkuser" id= "checkuser" value = "userid" onClick = "getname(this)">
</form>
www.RealisticGraphics.net
Running VS.Net Enterprise & VB 6
Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML
MSN Messenger: kmsheff
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|