Solved

AJAX-- access BackColor  And  ForeColor properties of the TextBox

Posted on 2012-03-11
2
278 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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
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
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

749 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