I currently have a contact form on my site that when clicked highlights the border in Orange.
There are icons in the fields that are grey at the moment ( see Here for print screen: http://i47.tinypic.com/2d6mvwp.jpg), I’m trying to get it so that when a field is clicked the image changes from the grey to an orange version. So essentially the field icon and the borders highlight at the same time depending on which one is clicked.
I’m hoping this is dead simple for someone, i think the main thing im struggling with is that the images are referenced through CSS
HTML part of the form is here:
<form method="post" action="contactengine.php">
<label for="Name"></label>
<input type="text" placeholder="Name" name="Name" id="Name"
<label for="Email"></label>
<input type="text" placeholder="E-mail" name="Email" id="Email" />
<label for="Message"></label><br />
<textarea name="Message" placeholder="Enter your message here..." rows="20" cols="20"></textarea>
<input type="image" name="submit" value="" src="Button_Static.png" onmouseover="this.src='Button_Hover.png'" onmouseout="this.src='Button_Static.png'" class="submit-button"/>
</form>
and the CSS behind the name and email fields is here (apologies the codeblock wasn’t enabling me to insert this correctly):
#Name{
background-image: url(NameIcon.png);
background-repeat: no-repeat;
background-size:32px 24px;
background-position-x: 10px;
background-position-y: 40%;
padding: 5px;
height: 30px;
width: 350px;
font-family: Helvetica, sans-serif;
font-size: .8em;
margin: 0px 0px 10px 0px;
border: 2pt solid #ccc;
text-indent: 50px;
/* Curved Boxes - Browser Compatability */
-moz-border-top-left-radius: 8px;
border-top-left-radius: 8px;
-moz-border-top-right-radius: 8px;
border-top-right-radius: 8px;
-moz-border-bottom-left-radius: 8px;
border-bottom-left-radius: 8px;
-moz-border-bottom-right-radius: 8px;
border-bottom-right-radius: 8px;
}
#Email {
background-image: url(EmailIcon.png);
background-repeat: no-repeat;
background-size:30px 17px;
background-position-x: 12px;
background-position-y: 40%;
padding: 5px;
height: 30px;
width: 350px;
font-family: Helvetica, sans-serif;
font-size: .8em;
margin: 0px 0px 10px 0px;
border: 2pt solid #ccc;
text-indent: 50px;
/*Curved text Boxes - Browser Compatability*/
-moz-border-top-left-radius: 8px;
border-top-left-radius: 8px;
-moz-border-top-right-radius: 8px;
border-top-right-radius: 8px;
-moz-border-bottom-left-radius: 8px;
border-bottom-left-radius: 8px;
-moz-border-bottom-right-radius: 8px;
border-bottom-right-radius: 8px;
}
Do another CSS style and use :focus that will apply to input elements with focus. Just change the image and border in there to the orange ones: