Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Check boxs and table row back ground colors
- From: mdougherty at pbp.com (Mike Dougherty)
- Subject: [Javascript] Check boxs and table row back ground colors
- Date: Tue Apr 25 10:03:35 2006
If you're going to make a bold statement about strict validation, I will one-up that with the best
practice suggestion to not register javascript inline either. Also, you probably want to make the
method fire a function rather than directly manipulating object properties. Then that function
should probably only alter the className property.
maybe something like this:
HTML: <input ... onMethod="highlightrow( this );" caveat="inline example easier to type up">
Javascript:
function highlightrow( obj ){
loTD = obj.parentNode; /* reference the TD containing the element that fired the method */
loTR = loTD.parentNode; /* reference the TR */
if(obj.checked){
loTR.className += " highlighted"; /* add the 'highlighted' class to this element */
}
else {
loTR.className = loTR.className.replace(/\shighlighted/g,""); /* remove the class */
}
}
CSS:
tr { background-color: white; }
tr.highlighted { background-color: not-white; }
Note: that regexp is probably not 100% right (sorry)
On Tue, 25 Apr 2006 15:57:12 +1000
"Abyss - Information" <Info@xxxxxxxx> wrote:
> the page is XHTML 1.1 strict compliant (which every page should be - *ducts from the objects
>that non compliant people throw*)
>
> <input id="chkbxID<%=rs("ID")%>" name="chkbxID" type="checkbox" value="<%=rs("ID")%>"
>onselect="this.style.background-color='#123456';" />
- Follow-Ups:
- [Javascript] Check boxs and table row back ground colors
- From: Steve Clay
- [Javascript] Check boxs and table row back ground colors
- References:
- [Javascript] Check boxs and table row back ground colors
- From: Abyss - Information
- [Javascript] Check boxs and table row back ground colors
- Prev by Date: [Javascript] hiding single td cells
- Next by Date: [Javascript] Check boxs and table row back ground colors
- Previous by thread: [Javascript] Check boxs and table row back ground colors
- Next by thread: [Javascript] Check boxs and table row back ground colors
- Index(es):