Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

PowerFullMac

macrumors 601
Original poster
Oct 16, 2006
4,000
2
Right, im new to HTML and want to learn, but im helping my friend out with a web app for the iPhone and need to make a text box you can type a number in to then press a button that will dial it. I know to dial a number you use <a href="tel:1-408-555-5555">1-408-555-5555</a> but how to I get it to take input from a text box?

Thanks in advance.
 
This should work...

HTML form:
Code:
<form name="dial" action="javascript:Dial()">
<input type="text" name="number">
<input type="Submit" value="Call">
</form>

Javascript:
Code:
<script>
function Dial(){
location.href="tel:"+document.dial.number.value;
}
</script>
 
One more thing, any tips on how to change that code to work with Google Maps, Mail etc.
 
Don't forget many of the features offered by Google are optional to being added to a site. They have a page with the code for all their features to make embedding their features into your site easy.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.