Vetrijar Posted March 3, 2004 Posted March 3, 2004 testing my site right now on the Internet *crossing fingers* Need to fix one thing though if someone has an answer on this. I have a box that requires the member to type at least 200 characters. is there a way to show the number of characters currently being typed ? That way the member doesn't have to count them or click a button to find how many are left? All I have is a textbox multiline and a label that will show the characters typed after the member clicks a button to refresh. Quote
kahlua001 Posted March 3, 2004 Posted March 3, 2004 Use javascript, use the onKeyUp event of the textbox, grab the lenght of the value of the textbox and set the innertext of a <span> Quote
Vetrijar Posted March 3, 2004 Author Posted March 3, 2004 Thanks. Is there a sample that you could show me? or a website that has a sample of something similar to that? could it be vbscript also? Quote
kahlua001 Posted March 3, 2004 Posted March 3, 2004 For Internet Explorer.. <script language="javascript"> function numChars(formfield) { document.getElementById('Characters').innerText = formfield.value.length; } </script> <p><span id="Characters"></span></p> <form name=form1> <input type=text name="Count" onKeyUp="numChars(this);"> </form> Quote
college_amy Posted March 5, 2004 Posted March 5, 2004 Does this work on only Internet Explorer or all browsers? Quote
Vetrijar Posted March 6, 2004 Author Posted March 6, 2004 Hmm.. Still see to have a slight problem now The javascript works when it's a textarea box that's not set with runat="server" Is there anyway to make that javascript run when the textarea is set to run at server mode? What I have is a list of textboxes, listboxes, etc that the user fills out. they click a save button that will run a vb.net function in aspx. this stores the stuff in a database. I also need to have the person know how many characters they have left (or using) for an essay question that requires 200 characters min, and 500 characters max. I really dont' want them having to manually count the characters or wait till they hit save just to find out they are short 103 characters or whatever. Quote
kahlua001 Posted March 6, 2004 Posted March 6, 2004 Are you adding the onKeyUp to the textarea's attributes? Quote
Vetrijar Posted March 7, 2004 Author Posted March 7, 2004 Are you adding the onKeyUp to the textarea's attributes? yes, I changed that now for it to work some. BUT THEN found something else that works good enough for me on teh server-side. I'm using the validator tools and applying them to the boxes. this works about the same "dynamic displaying" except it doesn't show the number of keys pressed. but that's ok for now. At least my site is done. I'm hoping it's done.. still have to see what happens when live people touch it. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.