Is it possible to have a textbox's focus using css? The background color should change when the cursor is in the active form field if possible, moving back to its original colour when another field is clicked.
At the moment I have this in <style>: - <style type=text/css>
-
-
p {font-family: verdana, arial, sans-serif; font-size: 10px;}
-
-
p.mySize {font-family: verdana, arial, sans-serif; font-size: 0.75em;}
-
-
table.myTable {margin-left:60px;}
-
-
input.blue {background-color: #D9F5F1; font-size: 12px; color: 1E1CDE;}
-
input.marine {background-color: #D9F5F1; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
-
textarea.marine {background-color: #D9F5F1; font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 12px;}
-
-
</style>
while the form itself, which is in a table, looks like this: - <table border="0" cellspacing="1">
-
<tr>
-
<td valign="top">
-
<p class="mySize">Name:</p>
-
</td>
-
<td colspan="2">
-
<input class="marine" name="ContactUs_Name" size="35" value="<% =ContactUs_Name %>">
-
</td>
-
</tr>
-
<tr>
-
<td valign="top">
-
<p class=mySize>Email:</p>
-
</td>
-
<td colspan="2">
-
<input class="marine" name="ContactUs_Email" size="35" value="<% =ContactUs_Email %>">
-
</td>
-
</tr>
-
<tr>
-
<td valign="top">
-
<p class="mySize">Subject:</p>
-
</td>
-
<td colspan="2">
-
<input class="marine" name="ContactUs_Subject" value="<% =ContactUs_Subject %>" size="35">
-
</td>
-
</tr>
-
<tr>
-
<td valign="top">
-
<p class="mySize">Message:</p>
-
</td>
-
<td valign="top">
-
<textarea class="marine" rows="10" name="ContactUs_Body" cols="35"><% =ContactUs_Body %></textarea>
-
</td>
-
</tr>
-
<tr>
-
<td valign="top">
-
-
</td>
-
<td colspan="2">
-
<input class="blue" type="submit" value="Send">
-
</td>
-
</tr>
-
</table>
Many thanks.
2 2483 Rabbit 12,516
Recognized Expert Moderator MVP
You can use the :focus selector. For it to work in IE8, a DOCTYPE has to be declared.
Hello Rabbit
Many thanks for that - I will read up on it.
Cheers
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Mike Berger |
last post by:
So, I'm fairly new to this and my code is as follows...
<script language="JavaScript>
var oldValue
function focusElement(theElement) {
oldValue = theElement.value;
return;
}
</script>
|
by: Rich Morey |
last post by:
Hello,
I have created a form and assigned each of the form elements to a
class in a style sheet.
I would like to know if it is possible to add 'OnFocus' and 'OnBlur'
events to the style sheet class so that I can change the background
color of a form element WITHOUT having to add 'OnFocus' and 'OnBlur'
events to each individual form element..
|
by: Michael Albanese |
last post by:
I am developing an application to handle my compay's OSHA
reporting requirements.
Some of the input criteria are technical and narowly
defined, so I was trying to prvide what i call "Context
Sensitive Help" by providing a short instructional message
based on which control has Focus.
Because of the way that a Radio Button List control is
rendered in the browser i can not attach an onFocus event
|
by: Paresh Shah |
last post by:
Hi Friends...
I have an query on how to capture onFocus event for all the input
controls without writing onFocus event in the <input> tag.
say my html form has 3 or 4 or 5 input text boxes, now I want to
capture onFocus event for all the text boxes without writing onFocus
code in <input> tag.
|
by: swathi |
last post by:
-----------------------------------------------------------------------
A poll associated with this post was created, to vote and see th
results, please visit http://www.forum4designers.com/message103437.htm
-----------------------------------------------------------------------
Question: iframe onfocus problem in mozilla browse
- attached zip fil
- multi.html in attached zi...
| |
by: Tzachi |
last post by:
Hello all,
I have a function that dynamically adds rows and columns to the page.
Everything works well except onfocus // onblur attributes. For some
reason, when entering the input box it doesn't highlight. If I delete
the onblur line, each of the boxes is highlighted all the time
regardless of focusing the input box.
Can someone help me?
|
by: Eric Trav |
last post by:
Hello,
I am using mozilla and javascript to change the style background color
for my select with onfocus() and back to white with onblur().
When i process onfocus(); i have to click on the select three times to
get the popup menu and everything seems slow. No errors are reported
in the console however it seems as if the click event is not being
processed after the focus event is processed.
|
by: clemtig |
last post by:
Say I have a form with two input textfields. Each has an onFocus and onBlur. onFocus will unhide image #1. onBlur will hide image #1, show image #2 and validate the textfield. But the problem is that I get errors when going from one field to another with this combination.
I've got it down to the point where I know that going from
input field 1: onBlur
--to--
input field 2: onBlur + onFocus
|
by: spree |
last post by:
Hi,
I have a coloumn of buttons where i would like to highlight it when focussed... So, i have used onFocus element for it. Till here its ok. But if i set any background color for the button and then use the onFocus element, its not getting focussed that is its not showing as focussed.So,could anybody help me to find out solution for this.
And also tell me how to change the default color of onFocus element to any desired color.
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |