Html label
<label>
开始,以</label>
结束
http://www.dreamdu.com/xhtml/tag_label/
<form id="dreamduform" action="http://www.dreamdu.com/dreamdu.php" method="post">
<label for="contactus">联系我们</label>
<textarea cols="50" rows="10" id="contactus">
可爱的猴子 dreamdu[at]163[dot]com
</textarea>
</form>
************************************************************************************<label for="contactus">联系我们</label>
<textarea cols="50" rows="10" id="contactus">
可爱的猴子 dreamdu[at]163[dot]com
</textarea>
</form>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="document.aspx.cs" Inherits="document" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script language="javascript" type="text/javascript">
function loa()
{
//然后再怎么获得opt1这个值
//alert(document.all["cblType"].childNodes[0].value);
alert(document.getElementById("cblTypeq").firstChild.nodeValue);
}
function ig_onchange()
{
// referring to the form by using its name as a variable won't work in most browsers (it will work in IE).
var form = document.forms['form1'].elements;
if (form.ig.checked)
{
form.btn.value = "Populate";
document.getElementById("labelId").firstChild.nodeValue="LATA *";
}
else
{
//can't work properly ,for "The label is not a form control, so it's not a property of the form"
//form.labelId.value = "LATA";
//The content of a label is normal HTML, so you can't refer to it as a simple property named "value".
document.getElementById("labelId").firstChild.nodeValue="LATA"//as same as the statement below
document.getElementById("labelId").innerHTML = "fas";
form.btn.value = "Validate";
}
}
</script>
</head>
<body onload="loa();">
<form id="form1" runat="server">
<table id="checkboxlist" border="0">
<tr>
<td>
<span id="cblType" style="color:#404040;">
<input id="cblType_0" type="checkbox" name="cblType$0" /><label id="cblTypeq" for="cblType_0">opt1</label>
<input id="cblType_1" type="checkbox" name="cblType$1" /><label for="cblType_1">opt2</label>
</span>
</td>
</tr>
</table>
<hr />
<p><input type="checkbox" name="ig" value="chkvalue" onclick="ig_onchange()"></p>
<p><label id="labelId" for="buttonId">LATA</label></p>
<p><input type="button" id="buttonId" name="btn" value="Validate"></p>
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script language="javascript" type="text/javascript">
function loa()
{
//然后再怎么获得opt1这个值
//alert(document.all["cblType"].childNodes[0].value);
alert(document.getElementById("cblTypeq").firstChild.nodeValue);
}
function ig_onchange()
{
// referring to the form by using its name as a variable won't work in most browsers (it will work in IE).
var form = document.forms['form1'].elements;
if (form.ig.checked)
{
form.btn.value = "Populate";
document.getElementById("labelId").firstChild.nodeValue="LATA *";
}
else
{
//can't work properly ,for "The label is not a form control, so it's not a property of the form"
//form.labelId.value = "LATA";
//The content of a label is normal HTML, so you can't refer to it as a simple property named "value".
document.getElementById("labelId").firstChild.nodeValue="LATA"//as same as the statement below
document.getElementById("labelId").innerHTML = "fas";
form.btn.value = "Validate";
}
}
</script>
</head>
<body onload="loa();">
<form id="form1" runat="server">
<table id="checkboxlist" border="0">
<tr>
<td>
<span id="cblType" style="color:#404040;">
<input id="cblType_0" type="checkbox" name="cblType$0" /><label id="cblTypeq" for="cblType_0">opt1</label>
<input id="cblType_1" type="checkbox" name="cblType$1" /><label for="cblType_1">opt2</label>
</span>
</td>
</tr>
</table>
<hr />
<p><input type="checkbox" name="ig" value="chkvalue" onclick="ig_onchange()"></p>
<p><label id="labelId" for="buttonId">LATA</label></p>
<p><input type="button" id="buttonId" name="btn" value="Validate"></p>
</form>
</body>
</html>
这种都是htmlgeneral控件
用InnerText