You are here: Re: input field « HTML « IT news, forums, messages
Re: input field

Posted by roN on 03/09/06 21:59

roN wrote:

> roN wrote:
>
>> Toby Inkster wrote:
>>
>>> roN wrote:
>>>
>>>> If you go to http://paykiosks.net/new/ad_campaign.htm you can see a
>>>> form with a textarea, on the left side of the textaarea, it displays,
>>>> how many characters are left after you started typing - actually I
>>>> would like to display them from the beginning, but that's another issue
>>>> (JS) - the last number of that number in the input field seems to be
>>>> cut, why that? How to change, that the whole number is displayed?
>>>
>>> Here is the table row in question:
>>>
>>> <tr>
>>> <td width="22%" align="right" class="text">Comments/
>>> Questions:<br><br> <input name="input1" size="1"
>>> style="border-width:0;background-color:#F7F7F7"
>>> onfocus="if(this.blur)this.blur()" class="text"> chars left </td>
>>> <td valign="top" width="78%"><span class="text">
>>> <textarea name="comments"
>>> onkeyup="count(event)" rows="8" cols="40"
>>> class="flat"></textarea> </span></td>
>>> </tr>
>>>
>>> Replace this with:
>>>
>>> <tr>
>>> <td width="22%" align="right" class="text">Comments/Questions:<br><br>
>>> <span id="charsleft"></span></td>
>>> <td valign="top" width="78%" class="text"><textarea name="comments"
>>> id="comments" rows="8" cols="40" class="flat"></textarea></td>
>>> </tr>
>>>
>>> In your Javascript you have:
>>>
>>> function count(e) {
>>> if (!e.which) keyCode = event.keyCode; // ie5+ op5+
>>> else keyCode = e.which; // nn6+
>>>
>>> if (document.Formular.comments.value.length<max+1)
>>> document.Formular.input1.value =
>>> max-document.Formular.comments.value.length;
>>> else {
>>> document.Formular.comments.value =
>>> document.Formular.comments.value.substring(0,max);
>>> document.Formular.input1.value = 0;
>>> }
>>> }
>>>
>>> Replace with:
>>>
>>> function count(e) {
>>> if (!e.which)
>>> keyCode = event.keyCode; // ie5+ op5+
>>> else
>>> keyCode = e.which; // nn6+
>>>
>>> if (document.Formular.comments.value.length<max+1)
>>> {
>>> document.getElementById('charsleft').innerHTML =
>>> (max - document.Formular.comments.value.length)
>>> & ' chars left';
>>> }
>>> else
>>> {
>>> document.Formular.comments.value =
>>> document.Formular.comments.value.substring(0,max);
>>> document.getElementById('charsleft').innerHTML =
>>> '0 chars left';
>>> }
>>> }
>>> document.getElementById('comments').onkeyup = count;
>>> window.onload = count;
>>>
>>> Should fix both problems and one more problem that you hadn't spotted.
>>>
>>
>> hm, I didn't get your version to work, please check back again at
>> http://paykiosks.net/new/ad_campaign.htm , Thank you, I'd appreciate!
>
> no more help? :(
> Thank you!

Hi, well, I got it working so far but it's not displaying '255' from the
beginning, I first need to type a letter into the textarea, why? how can I
change that? Thank you!
URL:http://paykiosks.net/new/ad_campaign.htm

--
chEErs roN

I'm root, I'm allowed to do this! ;)
keep on rockin'

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация