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: Info at Abyss.ws (Abyss - Information)
- Subject: [Javascript] Check boxs and table row back ground colors
- Date: Tue Apr 25 18:38:06 2006
Thank you for agreeing with...i like it when people do :)
and yes debugging something is a hell of a lot easier when you know how it
worked(or was supposed to work in the first place)
but if i wanted to fix- put in - the reg exp ... where would it go? (the
only reason why i ask is because - dare i say it - despise
javascript(probably because i learned back in the dark ages of the web when
the browser wars were on - and have shell shock from all the coding you had
to do and incompatibilities))
and coding is a test of ones character ...i already have so much character
from learning to build without tables to complete CSS design (*hears david
dorward in the background mumble and whinge about standards*)
Regards,
Abyss
while(sanity == normal) {
fncDoWebDevelopment(Brain, Patience, Family, CrappyISP, LackOfPay,
LongHours);
}
----- Original Message -----
From: "Mike Dougherty" <mdougherty@xxxxxxx>
To: "[JavaScript List]" <javascript@xxxxxxxxxx>
Sent: Wednesday, April 26, 2006 8:41 AM
Subject: Re: [Javascript] Check boxs and table row back ground colors
> You solution works fine in your example.
>
> the regexp is a handy way to generalize the solution to work on elements
> that already have a className that you might not even know about - or if
> the element is being acted on by multiple classes, each of which
> correspond to javascript behaviors.
>
> I agree that you should use what you know - it makes debugging easier when
> things go wrong. If your apps start to scale up, knowing about the
> generalized solution reminds you what to look up at google.
>
> On Wed, 26 Apr 2006 08:29:01 +1000
> "Abyss - Information" <Info@xxxxxxxx> wrote:
>> hey all thank you for all your great help...
>>
>> This is the function which I eventually end up with for the question on..
>>
>>
>>
>> function jsfncCheckboxBackgroundColor(chkRow)
>> {
>> var theRow = chkRow.parentNode;
>> //Make sure you are on the row element
>> while (theRow.nodeName != "TR")
>> {
>> theRow = theRow.parentNode;
>>
>> }
>> if(chkRow.checked)
>> {
>> theRow.className = "TableCheckboxChecked";
>> }
>> else
>> {
>> theRow.className = "TableCheckboxUnChecked";
>> }
>> }
>>
>>
>> why would i want to put in a regular expression in it? rather not why..i
>> understand why- as such...but where to put it? and would it make that
>> much more of a difference if i didn't put it in?
>>
>>
>> ----- Original Message ----- From: "Nick Fitzsimons"
>> <nick@xxxxxxxxxxxxxx>
>> To: "[JavaScript List]" <javascript@xxxxxxxxxx>
>> Sent: Wednesday, April 26, 2006 2:00 AM
>> Subject: Re: [Javascript] Check boxs and table row back ground colors
>>
>>
>>> Steve Clay wrote:
>>>> Tuesday, April 25, 2006, 11:06:32 AM, Mike Dougherty wrote:
>>>>
>>>>>loTR.className = loTR.className.replace(/\shighlighted/g,""); /* remove
>>>>>the class */
>>>>>Note: that regexp is probably not 100% right (sorry)
>>>>
>>>>
>>>> /\s*\bhighlighted\b/g
>>>>
>>>> \s* = zero or more whitespace chars
>>>> \b = word boundaries ensure not inside another word
>>>>
>>>> invaluable regular expression workbench:
>>>> http://osteele.com/tools/rework/
>>>>
>>>> Steve
>>>
>>> Unfortunately word boundaries can occur within classNames, as they
>>> include hyphens, meaning the above would incorrectly find a match on
>>>
>>> class="highlighted-blob"
>>>
>>> instead of just
>>>
>>> class="highlighted".
>>>
>>> Use:
>>> /(^|\\s)highlighted(\\s|$)/g
>>>
>>> which will match "highlighted" in the cases of:
>>>
>>> 1. At start of string followed by whitespace;
>>> 2. At end of string preceded by whitespace;
>>> 3. At start and end of string - that is, there is no whitespace
>>> anywhere.
>>>
>>> Not my own work - see the comments in Robert Nyman's "Ultimate
>>> getElementsByClassName", particularly:
>>> <http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-1583>
>>>
>>> Cheers,
>>>
>>> Nick.
>>> --
>>> Nick Fitzsimons
>>> http://www.nickfitz.co.uk/
>>>
>>>
>>> _______________________________________________
>>> Javascript mailing list
>>> Javascript@xxxxxxxxxx
>>> https://lists.LaTech.edu/mailman/listinfo/javascript
>>>
>>
>>
>> _______________________________________________
>> Javascript mailing list
>> Javascript@xxxxxxxxxx
>> https://lists.LaTech.edu/mailman/listinfo/javascript
>>
>>
>>
>> __________________________________________________________
>> This message was scanned by ATX
>> 6:31:22 PM ET - 4/25/2006
>
> _______________________________________________
> Javascript mailing list
> Javascript@xxxxxxxxxx
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
- References:
- [Javascript] Check boxs and table row back ground colors
- From: Abyss - Information
- [Javascript] Check boxs and table row back ground colors
- From: Mike Dougherty
- [Javascript] Check boxs and table row back ground colors
- From: Steve Clay
- [Javascript] Check boxs and table row back ground colors
- From: Nick Fitzsimons
- [Javascript] Check boxs and table row back ground colors
- From: Abyss - Information
- [Javascript] Check boxs and table row back ground colors
- From: Mike Dougherty
- [Javascript] Check boxs and table row back ground colors
- Prev by Date: [Javascript] Check boxs and table row back ground colors
- Next by Date: [Javascript] Hiding forms using <DIV>
- Previous by thread: [Javascript] Check boxs and table row back ground colors
- Next by thread: [Javascript] JavaScript reference guides [WAS: Check boxs and table row back ground colors]
- Index(es):