Nav Link On

iPhone Dev Forums > General Development > Web App Development > Making Custom Keyboards

Reply

 

LinkBack Thread Tools Display Modes
Old 12-14-2008, 03:12 PM   #1 (permalink)
Junior Member
Default Avatar
 
Join Date: Dec 2008
Posts: 5
Question Making Custom Keyboards

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;
					}
				}	
			}
So the point of this thread, besides giving other users a starting point, is to find a way to SPEED up this code some how, so pressing buttons is FAST. I've seen so many really complicated javascript things, I'm amazed that my super simple keyboard thats only a few lines of code, would be so slow.
l008com is offline   Reply With Quote
Reply

iPhone Dev Forums > General Development > Web App Development


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 RC1