Connecting Tech Pros Worldwide Forums | Help | Site Map

OnFocus Problem in Javascript

Member
 
Join Date: Mar 2008
Posts: 37
#1: Apr 17 '08
i use php,mysql & javascript for this project.

i use textbox for phone. i use 11 digit for that. first 3 digit(017) fixed for that.when cursor focus that field auto 017 set there. don't delete or insert another digit for that 017 digit. please help me..............

my problem:
Expand|Select|Wrap|Line Numbers
  1. <input type="text" name="phone" id="phone" onFocus="this.value='017'" value="" size="20" maxlength="11" />

gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,136
#2: Apr 17 '08

re: OnFocus Problem in Javascript


why don't just use a readonly textbox here? like:

[HTML]<input type="text" name="your_field_name" size="4" value="017" readonly="readonly"/>
<input type="text" name="phone" id="phone" size="20" maxlength="11"/>[/HTML]
kind regards
Member
 
Join Date: Mar 2008
Posts: 37
#3: Apr 17 '08

re: OnFocus Problem in Javascript


Quote:

Originally Posted by gits

why don't just use a readonly textbox here? like:

[HTML]<input type="text" name="your_field_name" size="4" value="017" readonly="readonly"/>
<input type="text" name="phone" id="phone" size="20" maxlength="11"/>[/HTML]
kind regards


thanks.
now how to add 2 textbox value in one textbox.please tell me.....
gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,136
#4: Apr 17 '08

re: OnFocus Problem in Javascript


Quote:

Originally Posted by Noorain

thanks.
now how to add 2 textbox value in one textbox.please tell me.....

whatfor? just use 2 textboxes or use css to make them appear as one ...

kind regards
Reply