Page 1 of 1

intput text onFocus

Posted: Mon Apr 09, 2007 2:12 pm
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?

Posted: Mon Apr 09, 2007 2:41 pm
by Kieran Huggins
check out jQuery and the focus() and val() methods

http://jquery.com
http://www.visualjquery.com/1.1.1.html

Posted: Mon Apr 09, 2007 3:35 pm
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

Posted: Mon Apr 09, 2007 4:36 pm
by Kieran Huggins
you should download it and put it on your own server - never link offsite for mission critical stuff.

Posted: Mon Apr 09, 2007 4:40 pm
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..." />

Posted: Mon Apr 09, 2007 6:09 pm
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)