Skip to content
WJunction - Webmaster Forum

simple html :(

Status
Not open for further replies.
how do i set onFocus in html?
I want for eg, a link, like the topic title, onFocus to get blue, and if not black.

I googled and tried a lot and nothing.

Help please? :( <3
 

13 comments

You dont need jScript. Use CSS.

Code:
<style  type="text/css">
a:link {COLOR: #0000FF;}
a:visited {COLOR: #800080;}
a:hover {COLOR: #FF0000;}
a:active {COLOR: #00FF00;}
</style>
 
<input name="textbox" type="text" value="Click here to type" onfocus="if(this.value=='Click here to type')this.value='';">

<A HREF="http://www.htmlgoodies.com" onClick="this.style.color='#FF0000'";>
 
You can also define custom links. for example:

Code:
a.mylink1 {color: #123123}
a.mylink2 {color: #321321}

so any <a> tag with the ID "mylink1" or "mylink2" ... such as..

<a href="#" id="mylink1">Test Link</a>

would follow the CSS above.
 
nope Jay i think he wants to focus an input area with js so when the user clicks the input it goes blank and when he comes out of the text area it goes back to Search...

Code:
<input id='searchField' name="q" onblur="if(this.value == ''){this.value = 'Search...';}" onfocus="if(this.value == 'Search...'){this.value = '';}"  type='text' value='Search...' />


This thats what you need!
 
Status
Not open for further replies.

About the author

pi0tr3k
Active Member · Joined
3,055
Messages
768
Reactions
113
Points

Advertise on WJunction

Reach 1000's of webmasters, hosts & affiliates. Banner & sponsored-thread slots available.

Contact us
Back
Top Bottom