Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

AJAX-- access BackColor  And  ForeColor properties of the TextBox

Posted on 2012-03-11
2
Medium Priority
?
284 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 2000 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

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, …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

718 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