Thursday, May 26, 2011

showLength() method

The showLength() method counts the amount of characters in a specified string. The answer can be returned by adding the object "str_len" to the result coding.

Browser support: all
TheMadScript version: 2.0.0

Syntax: showLength(string,result);


The syntax below will display the length of the sentence "Welcome back!" in an alert box:

showLength("Welcome back!","box_alert('The sentence has '+str_len+' characters.')");

No comments:

Post a Comment