Solved

AJAX-- access BackColor  And  ForeColor properties of the TextBox

Posted on 2012-03-11
2
279 Views
Last Modified: 2012-03-26
TextBox has BackColor  And  ForeColor properties.  It's easy to control/access these properties in Server-side code.  My question:

How can I access these properties in client-side code using AJAX or/and javascript ???

<asp:TextBox ID="txtName" runat="server"></asp:TextBox>

   <script type="text/javascript">

            var myName = document.getElementById('txtName');

            How can I access BackColor  And  ForeColor HERE???

    </script>


Thanks
0
Comment
Question by:niceguy971
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Accepted Solution

by:
dejaanbu earned 500 total points
ID: 37708488
like this:

 <script type="text/javascript">

            var myName = document.getElementById('txtName');

           myName.backgroundColor = '#336699';
           myName.color = '#FFFFFF';

    </script>

Open in new window


here is the Css and Js style attributes
http://www.comptechdoc.org/independent/web/cgi/javamanual/javastyle.html


if u r using master page,  u may need to use 'txtName.ClientId' instead of 'txtName'
0
 

Author Closing Comment

by:niceguy971
ID: 37769435
Thanks
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The most up-to-date version of this article is on my Blog https://iconoun.com/blog/
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question