<asp:CheckBox runat="server" ID="chkFavorites"Text="Show Favorites" Checked="true" /><br/>
/http://forums.asp.net/p/1018339/1373760.aspx
function getCheckBoxText(CheckBoxId)
{
var checkbox = document.getElementById(CheckBoxId);
//alert(checkbox.nextSibling);
//alert(checkbox.nextSibling.nodeType);
// alert(checkbox.nextSibling.nodeName);
//alert(checkbox.nextSibling.innerHTML);
if(checkbox.checked == true )//&& checkbox.nextSibling != null)
{
var label = checkbox.nextSibling;
//alert(label.innerText);
alert(label.innerHTML);
}
}
{
var list = "";
var idModifier = 0;
var checkbox = document.getElementById(("ctl00_ContentPlaceHolder1_lstFacility_" +
idModifier));
while(checkbox != null)
{
if(checkbox.checked == true)// && checkbox.nextSibling != null)
{
var label = checkbox.nextSibling;
list += label.innerText + ", ";
}
checkbox = document.getElementById(("ctl00_ContentPlaceHolder1_lstFacility_" +
(++idModifier).toString()));
}
// here you should remove any trailing
commas.
}
http://simonwillison.net/2003/Aug/11/documentAll/
document.all.length
is not support in firefox
for(i = 0; i < document.all.length; i++)
{
if
(document.all(i).tagName=="label")
{
document.getElementById(
'<%=
lblShowFavorite.ClientID %>').innerHTML = "<b>" +
document.all(i).innerText +" : " + "</b>" +
document.getElementById('<%=chkShowFav.ClientID%>').checked;
break;
}
}
No comments:
Post a Comment