@
@sh
Guys,
Working on a function to alert the user to too many characters being entered
into a text area, I've put together this function so far borrowing bits from
resource websites...
function
Ash_LimitMaxTextAreaCharacters(TheMaxCharacters,TheFriendlyFormName) {
if(document.myform.box.value.length > TheMaxCharacters) {
alert('Sorry but '+TheFriendlyFormName+' contains too many characters,
please remove '+
(document.myform.box.value.length - TheMaxCharacters)+ ' characters and
try again');
return false; }
else
return true; }
However I have many text areas throughout the site and wish to reuse this
function from a central include file, therefore I need to amend the function
to allow me to pass the name of the text area and the form that its within,
therefore how would it be amended and what would be the string to call it
via the Text area tag?
Something like...?
<textarea name="CampaignMailTextIntro" cols="125" rows="9"
id="CampaignMailTextIntro" onChange="Ash_LimitMaxTextAreaCharacters(50,'The
Intro Text Form');"></textarea>
Appreciate your help!!
Cheers, Ash
Working on a function to alert the user to too many characters being entered
into a text area, I've put together this function so far borrowing bits from
resource websites...
function
Ash_LimitMaxTextAreaCharacters(TheMaxCharacters,TheFriendlyFormName) {
if(document.myform.box.value.length > TheMaxCharacters) {
alert('Sorry but '+TheFriendlyFormName+' contains too many characters,
please remove '+
(document.myform.box.value.length - TheMaxCharacters)+ ' characters and
try again');
return false; }
else
return true; }
However I have many text areas throughout the site and wish to reuse this
function from a central include file, therefore I need to amend the function
to allow me to pass the name of the text area and the form that its within,
therefore how would it be amended and what would be the string to call it
via the Text area tag?
Something like...?
<textarea name="CampaignMailTextIntro" cols="125" rows="9"
id="CampaignMailTextIntro" onChange="Ash_LimitMaxTextAreaCharacters(50,'The
Intro Text Form');"></textarea>
Appreciate your help!!
Cheers, Ash