Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-06-2012, 02:42 AM   PM User | #1
legendrock7
New Coder

 
Join Date: Sep 2012
Posts: 58
Thanks: 8
Thanked 0 Times in 0 Posts
legendrock7 is an unknown quantity at this point
input field color help

Hi, i found a website that there input field is colored & brightens once u click on the field. How do i do that? Here's my input field code

Code:
<input name="name" value="Server Name" /><br><input name="ip" value="Server IP" /><br><input name="port" value="Server Port" />
legendrock7 is offline   Reply With Quote
Old 10-06-2012, 05:46 AM   PM User | #2
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,383
Thanks: 18
Thanked 350 Times in 349 Posts
sunfighter is on a distinguished road
First added css to get a back ground color. Then added an ID so the back ground color knows what to color. Then added onfocus, it could have been an onclick, to change the color via a javascript command. I only added it to the first input.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css">
#name, #ip, #port{
	background-color: SlateGray;
}
</style>
</head>
<body>
<input id="name" onfocus="this.style.backgroundColor='silver';" name="name" value="Server Name" /><br />
<input id="ip" name="ip" value="Server IP" /><br />
<input id="port" name="port" value="Server Port" />
</body>
</html>
sunfighter is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:02 AM.


Advertisement
Log in to turn off these ads.