input field

R

roN

Hi,

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?
Thank you!

tested with:
FF in Win and KDE
IE in Win
 
T

Toby Inkster

roN said:
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.
 
C

cruiserweight

How to change, that the whole number is displayed?

Just a thought: Your input size is 1. Try making the value bigger, ie
<input size="5" ...
 
R

roN

Toby said:
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!
 
T

Toby Inkster

roN said:
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?

Did you add the window.onload?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top