intput text onFocus

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
joran420
Forum Newbie
Posts: 8
Joined: Wed Apr 04, 2007 8:06 pm

intput text onFocus

Post by joran420 »

not really a php question
but how can i change a textfield when it receives user focus
<input TYPE ="TEXT" WIDTH="35PX" class="whatever" name="focText">

focText.onFocus setVal="You put focus here"

type thing?
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

check out jQuery and the focus() and val() methods

http://jquery.com
http://www.visualjquery.com/1.1.1.html
joran420
Forum Newbie
Posts: 8
Joined: Wed Apr 04, 2007 8:06 pm

Post by joran420 »

wow that jquery is neat....but what happens if i start including it and they take the src offline or something?

I think i found a easy enough way to do it just JS it in....we'll see but im gonna have to checkout that jquery more in depth
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

you should download it and put it on your own server - never link offsite for mission critical stuff.
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Post by JAB Creations »

I'm not completely sure though this might be what you're looking for...

Code: Select all

<label class="search" for="query_string" title="Search our website.">Search Site</label><input class="query" id="query_string" maxlength="50" name="query_string" onfocus="javascript:if(this.value=='Search...') {this.value='';}" onblur="javascript:if(this.value=='') {this.value='Search...'}" size="9" tabindex="1" type="text" value="Search..." />
joran420
Forum Newbie
Posts: 8
Joined: Wed Apr 04, 2007 8:06 pm

Post by joran420 »

much obliged :) thats perfect i am gonna DL that jsquery thing though cause thats pretty awesome :)
btw anyone know any good articles(prefferably free) on security and mysql/php databases?(totally OT)
Post Reply