Wednesday, 15 January 2014

javascript - Show international phone format for international visitors only -



javascript - Show international phone format for international visitors only -

i wondering if there's javascript can utilize when international visitor (non-us) visits site, they'll see international phone format can follow. changing "value" international phone format example.

this code input field have...

<input id="phone" class="numphone" maxlength="255" name="phone_number" type="text" tabindex="6" value="(555) 123-4567" onblur="if (this.value == '') {this.value = '(555) 123-4567';}" onfocus="if (this.value == '(555) 123-4567') {this.value = '';}" />

thanks!

there no way observe programmatically whether visitor “international” or “non-us”, meaningful definition of such concepts. using geolocation , other tools, might able decide, perhaps acceptable margin of error, whether user’s device located in territory or not. won’t tell whether user european or asian businessman visiting us, example, or citizen using computer outside us.

moreover, seems input format, should inquire users come in phone number in international format perhaps imply if country prefix missing (or prompt corrected information). , should parse phone number “(”, “)”, “-”, , space ignored, because carry no relevant info typed people familiar such notations.

javascript jquery html

No comments:

Post a Comment