Wrox Programmer Forums
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 19th, 2004, 11:14 AM
Authorized User
Join Date: Jan 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default leading zero's in text box

How do I get a text box to add leading zero's to any number entered. So the text box will be 9 characters max in length. If a user enter 5 numbers, I would the other 4 numbers to be leading zero's. For example, if a user entered 12345, I would like the result when the web form is submitted to look like 000012345.

Please help.

Old October 19th, 2004, 11:18 AM
Friend of Wrox
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post

Cross post at http://p2p.wrox.com/topic.asp?TOPIC_ID=20912

Old November 4th, 2004, 05:06 AM
Friend of Wrox
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919

Hi Tee
Try this one,Hope it will help you
function addzero()


<form name=test>
<INPUT Type=text Name=myval maxlength=9>
<input type=button name=x value=y onclick=addzero()>
 Cheers !!!


Similar Threads
Thread Thread Starter Forum Replies Last Post
Grab Values From List Box into Text Box phungleon VB How-To 2 June 19th, 2008 10:33 PM
Count in combo box(display results in text box) mboyisis Access 4 April 4th, 2008 07:08 AM
Leading and Kerning of Text vijay.bhaskar General .NET 0 September 26th, 2007 12:06 AM
Why do I lose 0 Zero's when calculating? easybee Classic ASP Databases 1 December 18th, 2003 12:34 AM
Search using drop down list box and a text box tcasp Classic ASP Basics 1 July 31st, 2003 02:58 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.