Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Text Colour in Table Cells in NS

Status
Not open for further replies.

YogeshPancholi

Programmer
Jul 4, 2000
14
0
0
CA
I am a Netscape Neophite, so please excuse me if my question has a very obvious answer.

I have developed an HTML page in IE that consists of a form whose input field and label name are contained in separate cells of a table. On clicking submit, my JavaScript performs client-side validation, and if it encounters any input errors, the label text becomes red, and an error message is posted at the bottom of the page.

My question is how can I get the page to behave identically in Netscape? Below is a small sample of my HTML for clarity.

<BODY>
<FORM>
<TABLE>
<TR>
<TD id=&quot;tdName&quot; class=&quot;colorBlack&quot;>First Name:</td>
<TD><input id=&quot;idName&quot; type=&quot;text&quot;></td>
</tr>
...
... some more input fields and labels go here
...
<TR>
<TD id=&quot;tdErr&quot; class=&quot;colorRed&quot;></td>
</tr>
</table>
</form>
</body>

In IE, if a form field contains an error, I change the tdName's color style to red, and set the tdErr's innerText property to some error message.

Is it possible to get such a form working across IE and NS?

Any constructive responses will be greatly appreciated.




Yogesh Pancholi

&quot;If a pig loses its voice, is it disgruntled?&quot;
 
Netscape doesn't support setting CSS styles to <TD> elements. The best way (which works in IE and NN) is to use a <TD><DIV id=&quot;tdErr&quot; class=&quot;colorRed&quot;>your_HTML</DIV></TD>

The <DIV> tag is supported by both Netscape and IE, but you should read up on the documentation of both, because they use slightly different syntax. The one difference that will matter most to you is inside your style declaration IE needs &quot;background-color: red;&quot;, while Netscape needs &quot;layer-background-color: red;&quot;, so you need to use both.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top