View Full Version : SOS!How can I get "tr" bgcolor?

03-22-2004, 07:52 AM
I want to chang "tr" bgcolor when doble-click it, but I fail because I can not get "tr" bgcolor.The codes appear like this:
<table width="200" border="1">
<tr bgcolor="#FFFFFF" id="tr" align="center" onDblClick="alert(tr.align);alert(tr.bgcolor)">

03-22-2004, 08:02 AM
Should be:

<tr bgcolor="#FFFFFF" id="tr" align="center" ondblclick="alert(this.bgColor)">

But you must start now to learn and apply CSS (http://www.w3schools.com/css/default.asp) in favor of old attributes like align and bgcolor.

<tr style="background-color:#FFFFFF;text-align:center" ondblclick="alert(this.style.backgroundColor);alert(this.style.textAlign);">