If you take a look at the textarea for commenting on this page you'll see my desire.
When hovering over the textarea the bgcolor changes, but once the textarea is clicked it maintains this new color until the area loses focus.
What's going on guys?
Edit. I posted this in the wrong darn forum!
9 2825 Atli 5,058
Expert 4TB
You can use the onMouseOver, onMouseOut, onFocus and onBlur events to do this.
You will just have to create a JavaScript variable that indicates whether the input has focus. When it does, prevent the onMouseOut event from changing the color.
Edit. I posted this in the wrong darn forum!
I'll move it over to the JavaScript forums.
Atli 5,058
Expert 4TB
Or better yet... The CSS :hover and :focus effects -
textarea {
-
background-color: #FFFFFF;
-
}
-
textarea:hover, textarea:focus {
-
background-color: #FFFFCC;
-
}
-
Doesn't work in IE tho :(
(Grrr @ M$)
Well, its still in the wrong forum :p
Use this css - textarea.effect, input.effect {
-
background-color:#eeeeff;
-
}
-
textarea.effect:hover, input.effect:hover,textarea.effect:focus, input.effect:focus {
-
background-color:#ffeeee;
-
}
where effect is the class name of the textareas and input boxes to whom you want to apply this.
[EDIT].. I'm late.. already done by Atli :)
Or better yet... The CSS :hover and :focus effects -
textarea {
-
background-color: #FFFFFF;
-
}
-
textarea:hover, textarea:focus {
-
background-color: #FFFFCC;
-
}
-
Doesn't work in IE tho :(
(Grrr @ M$)
Hi,
This code is working in IE on Strict Mode.
Hi,
This code is working in IE on Strict Mode.
Strict Mode.. .... Strict Doctype?
Hi,
This code is working in IE on Strict Mode.
I guess that would be IE7.
You can use the onMouseOver, onMouseOut, onFocus and onBlur events to do this.
You will just have to create a JavaScript variable that indicates whether the input has focus. When it does, prevent the onMouseOut event from changing the color.
CSS :hover pseudo-classes are not supported by IE7 unless a doctype is provided, so you will need to use JavaScript to achieve this (if you also need to support IE6).
Thanks for all the responses guys!
They all, at a glance, are what I'm looking for.
Wasn't a major thing, just a query.
:)
This CSS code worked fine for me too in Chrome :)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: John D |
last post by:
I am trying to change the background colour of either a div or a textarea
with javascript, but am having problems.
I have passed a hex colour value in the variable hval, and with the
following...
|
by: dan.vendel |
last post by:
Hi,
I know nothing about javascript, but quite a lot about regulat html and
CSS.
Have bumped into a problem that people in this fine congregation
perhaps can help me with.
I'm making a...
|
by: GaryDean |
last post by:
In the original post I failed so indicate that I am using framework
1.1.......
I need to be able to change the background color of a page from code. I
found an answer to this question in...
|
by: phillip.s.powell |
last post by:
<style>
div div table tr td a.navbar, div div table tr td font {display:
none;}
</style>
<div class="navigationbar" style="background-color:Black; position:
absolute; left:50%; top:127px;...
|
by: Keith Bentrup |
last post by:
Hi all,
I wrote a simple search function to find text in a textarea where not
all the text is visible (ie. the text box displays 10 lines but there
may be more than 1000 lines to search). I can...
|
by: lawrenceS59 |
last post by:
Hi all,
I'm fairly new to web development so bare with me.
The html page that i've created isn't working and i can't figure out why. I'm guessing there are some rules that need to be...
|
by: lawrenceS59 |
last post by:
Hi all,
I'm fairly new to web development so bare with me.
The html page that i've created isn't working and i can't figure out why. I'm guessing there are some rules that need to be followed...
|
by: Markus |
last post by:
If you take a look at the textarea for commenting on this page you'll see my desire.
When hovering over the textarea the bgcolor changes, but once the textarea is clicked it maintains this new...
|
by: globalrev |
last post by:
i have a translator-program for the robbers language.
i want the user to input into the topwindow and then display the
encryption or decryption in the bottom window.
i am currently trying to...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM).
In this month's session, the creator of the excellent VBE...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Aftab Ahmad |
last post by:
Hello Experts!
I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
| |