Knud
05-05-2005, 06:54 AM
Script: DD Tab Menu
http://www.dynamicdrive.com/dynamicindex16/limitinput.htm
I'm just using the "Form field Limiter" script and have a problem that I can't work out.
I need to change the counting section of the script so that the enter key is worth 2 characters instead of 1.
I really have no idea how to change this could someone post me some code to help me please.
A handy addon for this script I did work out was to change the value of the number of text limited if there is text in the form element when the page is loaded.
e.g.
*****************
function displaylimit(thename, theid, thelimit, currentlimit){
var theform=theid!=""? document.getElementById(theid) : thename
var limit_text='<span id="'+theform.toString()+'">'+currentlimit+'</span> characters remaining'
if (document.all||ns6)
document.write(limit_text)
if (document.all){
eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
}
else if (ns6){
document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true);
document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true);
}
}
****************
the currentlimit value can be worked out when creating the page asp etc. This helps if you are changing or updating information.
http://www.dynamicdrive.com/dynamicindex16/limitinput.htm
I'm just using the "Form field Limiter" script and have a problem that I can't work out.
I need to change the counting section of the script so that the enter key is worth 2 characters instead of 1.
I really have no idea how to change this could someone post me some code to help me please.
A handy addon for this script I did work out was to change the value of the number of text limited if there is text in the form element when the page is loaded.
e.g.
*****************
function displaylimit(thename, theid, thelimit, currentlimit){
var theform=theid!=""? document.getElementById(theid) : thename
var limit_text='<span id="'+theform.toString()+'">'+currentlimit+'</span> characters remaining'
if (document.all||ns6)
document.write(limit_text)
if (document.all){
eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
}
else if (ns6){
document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true);
document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true);
}
}
****************
the currentlimit value can be worked out when creating the page asp etc. This helps if you are changing or updating information.