473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to change the background color in the textarea while selecting the color

pls help me to solve this problem i am developing the application in javascript
Aug 13 '07 #1
4 3102
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!

Can you elaborate further? While selecting what color?

To change the background colour, use the style.backgroundColor property:
Expand|Select|Wrap|Line Numbers
  1. textareaObj.style.backgroundColor='#000000';//black
Aug 13 '07 #2
I have a related question: how can I read the backgroundColor property of an element on the page? I want to be able to click on a div and see what color it is, but I can't read the backgroundColor property. I can read it after I change it in the javascript, but not the default color before I changed it. I want to read it from the element rather than from the stylesheets rules collection for reasons that make more sense when you look at the complete code, but here's an excerpt:


[HTML]<head>

<style type="text/css">
<!--
#theme {
position:absolute;
top:10px;
height:100px;
width:100px;
background-color:#FF99CC;
}
-->
</style>
<script language="JavaScript" type="text/javascript">
function showColor(id) {
alert(document.getElementById(id).style.background Color);
document.getElementById(id).style.backgroundColor = '#CCCCCC';
alert(document.getElementById(id).style.background Color);
}
</script>
</head>

<body>
<div id="theme" onclick="showColor(this.id)">hello</div>
</body>[/HTML]


Thanks!
Sep 30 '07 #3
btw, the space between "background" and "Color" isn't in the original code, I guess it gets added in when I paste it in the post window
Sep 30 '07 #4
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!

Please use code tags when posting code:

[CODE=javascript]
JavaScript code ...
[/code]

Interesting problem. I'll see if I come across a fix/solution.
Sep 30 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Krzysztof Fink-Finowicki via .NET 247 | last post by:
I have problem with TEXTAREA HTML tags in my Web application (MSIE 6.0). User fills-in content of TEXTAREA on HTML dialog window. After accepting, content of TEXTAREA from dialog window is...
11
by: Konrad Den Ende | last post by:
I have a function returning a string but the problem is that the color of it is blue which suits me well for some pages but not for others. Is it possible to "feel" what the color of the background...
7
by: Paul Gorodyansky | last post by:
Hi, Say I have a text in my TEXTAREA box - 01234567890 I want - using script - insert say "abc" in the middle. Works almost OK in Internet Explorer (with one problem) based on their example...
4
by: TJS | last post by:
can the rows and columns of a textarea element with an id be changed on the fly ? if so is there an example ?
4
by: Mel | last post by:
how can i change disabled background on all form elements ?
0
by: Fabio R. | last post by:
Hi, I'm using an image background for a textarea but it scroll well only in IE, not in Firefox... Is there a way to let the background scrolling when I use the textarea scrollbar? Thanks, Fabio
8
by: addoty | last post by:
We have a web application that has a lot of large textareas for data collection. We need to track who makes changes, when and what changes were made. Right now I'm storing the entire text in a...
2
by: mdejac | last post by:
I was wondering why the background color is not showing up in Mozilla. When I view the page there is a light blue background, when it should be black. Thank you for any help. ...
1
by: pbd22 | last post by:
Hi all. I am using styles to lock down the GUI until the user enters some info in a CSS/DIV pop box. If the user does now scroll before he clicks, the pop box is centered and the background...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.