Solved

AJAX-- access BackColor  And  ForeColor properties of the TextBox

Posted on 2012-03-11
2
274 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
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now