SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Evangelist
    Join Date
    Jan 2005
    Location
    UK
    Posts
    539
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile highlight row and all textareas within

    I have been using a cool js bit of code to highlight an entire row if a checkbox is ticked...found on this forum

    Code:
    <script language="JavaScript">
    
    function toggle_highlight(inputTagReference)
    {
    	var is_checked = inputTagReference.checked; //true or false
    	if(is_checked)
    	{
    		inputTagReference.parentNode.parentNode.style.backgroundColor="#ffffcc";
    	}
    	else
    	{
    		inputTagReference.parentNode.parentNode.style.backgroundColor="";
    	}
    }
    
    </script>
    ..now i'm wondering if it's possible to change the bg colour of all textboxes/textareas in that row at the same time?

  2. #2
    SitePoint Guru
    Join Date
    Apr 2006
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    once you get a reference to the row, get its descendent textareas with
    rowreference.getElementsByTagName('textarea');

    Or you could just set the css: td textarea{background-color:transparent}

  3. #3
    SitePoint Evangelist
    Join Date
    Jan 2005
    Location
    UK
    Posts
    539
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks it didn't think of setting them to transparent!!

    Also, do you know how to have a checkbox set on when a user clicks in any of that rows textboxes/textareas?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •