Script Question...


1

116

I created this script so in a 'textarea' with a MAX character count, the user
can see what the count remaining is. I am trying to have the text write with
a font size of (1 8pt). Can someone tell me what I am missing?

<script type="text/javascript">
function charleft()
{
with (document.forms[0])
{
var txtcnt = (S1.value.length)
var cmnt = "Characters Remaining "
var txtmax = '100'
var txtrmn = txtmax - txtcnt
var rmnstr = (cmnt.concat(txtrmn))

document.getElementById("CL").innerHTML = rmnstr;

}
}
</script>

Thanks
David
 
Ad

Advertisements

J

Jon Spivey

Either
document.getElementById("CL").innerHTML = '<span style="font-size:18px;">' +
rmnstr + '</spam>';
or probably better stick this in the head or add to your existing stylesheet
<style type="text/css">
#CL{
font-size:18px;
}
</style>

Cheers,
Jon
http://MyMobileDeal.com
 
1

116

Thank you. I found a link in here w3schools. I should have looked first.
Another question. I have been messing with this script, and I have an
'onkeydown' event to start the countdown. But nothing on the first key press.

function charleft()
{
with (document.forms[0])
{
var txtcnt = (S1.value.length)
var cmnt = "Characters Remaining "
var txtmax = '100'
var txtrmn = txtmax - txtcnt
var rmnstr = "(" + (cmnt.concat(txtrmn)) + ")"

document.getElementById("CharRem").innerHTML = rmnstr.fontsize(1);

}
}
</script>


Jon Spivey said:
Either
document.getElementById("CL").innerHTML = '<span style="font-size:18px;">' +
rmnstr + '</spam>';
or probably better stick this in the head or add to your existing stylesheet
<style type="text/css">
#CL{
font-size:18px;
}
</style>

Cheers,
Jon
http://MyMobileDeal.com


116 said:
I created this script so in a 'textarea' with a MAX character count, the
user
can see what the count remaining is. I am trying to have the text write
with
a font size of (1 8pt). Can someone tell me what I am missing?

<script type="text/javascript">
function charleft()
{
with (document.forms[0])
{
var txtcnt = (S1.value.length)
var cmnt = "Characters Remaining "
var txtmax = '100'
var txtrmn = txtmax - txtcnt
var rmnstr = (cmnt.concat(txtrmn))

document.getElementById("CL").innerHTML = rmnstr;

}
}
</script>

Thanks
David


.
 
H

Hot-text

<font face="Symbol" size="6" color="red">
<script type="text/javascript">
document.write("font face red")

</script>
</font>
 
Ad

Advertisements

J

Jon Spivey

How about just doing this?
<form>
<textarea onkeyup="check(this.value.length);"></textarea>
</form>
<div id="chars">100 chars remaining</div>
<script type="text/javascript">
function check() {
document.getElementById("chars").innerHTML = 100 - arguments[0] + ' chars
remaining';
}
</script>


116 said:
Thank you. I found a link in here w3schools. I should have looked first.
Another question. I have been messing with this script, and I have an
'onkeydown' event to start the countdown. But nothing on the first key
press.

function charleft()
{
with (document.forms[0])
{
var txtcnt = (S1.value.length)
var cmnt = "Characters Remaining "
var txtmax = '100'
var txtrmn = txtmax - txtcnt
var rmnstr = "(" + (cmnt.concat(txtrmn)) + ")"

document.getElementById("CharRem").innerHTML = rmnstr.fontsize(1);

}
}
</script>


Jon Spivey said:
Either
document.getElementById("CL").innerHTML = '<span
style="font-size:18px;">' +
rmnstr + '</spam>';
or probably better stick this in the head or add to your existing
stylesheet
<style type="text/css">
#CL{
font-size:18px;
}
</style>

Cheers,
Jon
http://MyMobileDeal.com


116 said:
I created this script so in a 'textarea' with a MAX character count, the
user
can see what the count remaining is. I am trying to have the text
write
with
a font size of (1 8pt). Can someone tell me what I am missing?

<script type="text/javascript">
function charleft()
{
with (document.forms[0])
{
var txtcnt = (S1.value.length)
var cmnt = "Characters Remaining "
var txtmax = '100'
var txtrmn = txtmax - txtcnt
var rmnstr = (cmnt.concat(txtrmn))

document.getElementById("CL").innerHTML = rmnstr;

}
}
</script>

Thanks
David


.
 

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

Top