Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

Form field value change onclick

Hi,

How do I change the value for a field in my form when sombody clicks in that field?

for example i have a field for "name" and it should say "name" in it, but when you click in it the value changes to nothing.

Thanks,

CodeDownload  
echo "<input type='text' name='user_name' class='textbox' style='width:100px' value ='".$locale['global_101']."' onclick='if(this.value == '".$locale['global_101']."') this.value = '';' onblur='if(this.value == '') this.value = '".$locale['global_101']."';' />\n";


i have try like this but its not working
try this
CodeDownload  
echo "<input type='text' name='user_name' class='textbox' style='width:100px' value ='".$locale['global_101']."' onblur=\"if(this.value == '') this.value = '".$locale['global_101']."';\" onfocus=\"if(this.value=='".$locale['global_101']."') this.value = '';\" />\n";

thanks.. its working.. perfect.. :o
Working, great. thanks.
Thread Information
Author
Posted In
Replies
4 posts
Views
15,107 times
Last Post
Last updated on 9 years ago
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: SiteMaster, aRiFiN, Weberje