pasdronlivar
oloornoorli
relolodronb
If you wish to add a box which monitors the length of the comments, and ensures that people don't post more than the character limit, add this code to your Haloscan Template between the <head> </head> tags
then replace
with this
then where you want it to appear, add this
Things to note, you can adjust the maximum post length by changing the variable in the first piece of code, although remember that there is a 10,000 character limit which Haloscan will automatically trim your posts down too.
There's nothing stopping you from adding styles and classes to the tags to make them appear nicer.
You can see an example running on my blog http://blog.artesea.co.uk/∞
to
where the percentage is what you had, and the new px width is what looks the nicest.
oloornoorli
relolodronb
Comment Length Counter
Premium Members OnlyIf you wish to add a box which monitors the length of the comments, and ensures that people don't post more than the character limit, add this code to your Haloscan Template between the <head> </head> tags
<script language="javascript1.2" type="text/javascript">
<!--
var maxChars = 10000;
function charsleft()
{
theInputBox = document.getElementById('messageText');
theCountBox = document.getElementById('charsLeft');
var currentChars = theInputBox.value.length;
theCountBox.value = Math.max((maxChars - currentChars),0);
if(currentChars > maxChars)
{
theInputBox.value = theInputBox.value.substring(0,maxChars);
}
}
-->
</script>
<!--
var maxChars = 10000;
function charsleft()
{
theInputBox = document.getElementById('messageText');
theCountBox = document.getElementById('charsLeft');
var currentChars = theInputBox.value.length;
theCountBox.value = Math.max((maxChars - currentChars),0);
if(currentChars > maxChars)
{
theInputBox.value = theInputBox.value.substring(0,maxChars);
}
}
-->
</script>
then replace
<textarea name="addMessage">{HSVisitorMessage}</textarea>with this
<textarea name="addMessage" id="messageText" onchange="charsleft()" onkeyup="charsleft()" onfocus="charsleft()" onblur="charsleft()">{HSVisitorMessage}</textarea>then where you want it to appear, add this
Characters Remaining: <input type="text" readonly="readonly" id="charsLeft" />
Things to note, you can adjust the maximum post length by changing the variable in the first piece of code, although remember that there is a 10,000 character limit which Haloscan will automatically trim your posts down too.
There's nothing stopping you from adding styles and classes to the tags to make them appear nicer.
You can see an example running on my blog http://blog.artesea.co.uk/∞
Bug Note
Internet Explorer will resize text boxes which are percentage width instead of pixel width, when you start typing. To stop this change your style sheet where you seetextarea {width: 100%; }
to
textarea {width: 342px; }
where the percentage is what you had, and the new px width is what looks the nicest.