|
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Junior Member
Join Date: Dec 2008
Posts: 5
|
I have a page on my site where I want the user to enter their Zip Code. Using a regular old text field is lame since its wasting tons of screen space and you have to convert it to numbers anyway. So I made my own keyboard in javascript, seen here:
MenuLizard iPhone They keyboard is a single image, imagemapped. The text field is just a div styled to look like a text box. So when you type with the keyboard, it adds digits to the DIV then also adds them to a hidden form element. It works quite well on a regular browser. But on the phone, it's so slow, its painful to use. If you type at normal speed, you are going to get one, maybe two digits. When you click on a button it just calls the following function, for example when you click on the 5 key it calls buttontype('5') And here is the function itself: Code:
You must Login or Register to view and contribute code! This is done to increase participation in helping one another out, if you have been helped please pass on the favor. function buttontype(dingding)
{
if (dingding == 'x')
{
if (document.getElementById("zipcode").value.length)
{
var shortstring = document.getElementById("zipdisplay").innerHTML;
shortstring = shortstring.substring(0,(document.getElementById("zipcode").value.length - 1));
document.getElementById("zipdisplay").innerHTML = shortstring;
document.getElementById("zipcode").value = shortstring;
}
}
else
{
if (document.getElementById("zipcode").value.length < 5)
{
document.getElementById("zipdisplay").innerHTML += dingding;
document.getElementById("zipcode").value += dingding;
}
}
}
__________________
PixelAds! ♦ Restaurant Menus ♦ Mac Repair Boston ♦ WhatsMyIP ♦ IPSite ♦ Random Websites |
|
|
|
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Search Engine Friendly URLs by vBSEO 3.3.0 RC1 |




Linear Mode
