<script language=<JavaScript">
var str = "My name is Rick"; alert(str.length); |
<script language=<JavaScript1.1">
var str = new String("My name is Rick"); alert(str.length); |
|
// reference a variable from
the parent window
var customer = parent.custName + ""; |
// reference a variable from
the parent window
var = new String(); customer = parent.custName; |
|
</script> | </script> |
Method/Property | Description | Example | Value Returned | |||
.length | Returns the length of the string as an interger. | "horse".length | 5 | |||
.charAt(pos) | Returns the character at the position. | "horse".charAt(0) | "h" | |||
.indexOf(text) .indexOf(text, startPos) |
Returns the first occurance of the string after the starting postition. The starting postion defaults to zero. | "manners".indexOf("n") | 2 | |||
.lastIndexOf(text) .lastIndexOf(text, startPos) |
Returns the last occurance of the string before the ending postition. The ending postion defaults to end of the string. | "manners".lastIndexOf("n") | 3 | |||
.substring(startPos, endPos) | Returns the substring starting at startPos and ending with endPos. | "manners".substring(0,2) | "man" |
JavaScript | HTML Returned | |
"Chapter 1".anchor("ch1") | <A NAME=ch1>Chapter 1</A> | |
"highlight".big() | <BIG>highlight</BIG> | |
"I hate blinking text".blink() | <BLINK>I hate blinking text</BLINK> | |
"a = b + c".fixed() | <TT>a = b + c</TT> | |
"grass".fontcolor("green") | <FONT COLOR="green">grass</FONT> | |
"grass".fontsize(2) | <FONT SIZE="2">grass</FONT> | |
"Title".italics() | <I>Title</I> | |
"Yahoo".link("http://www.yahoo.com/") | <A HREF="http://www.yahoo.com/">Yahoo</A> | |
"footnote".small() | <SMALL>footnote</SMALL> | |
"old stuff".strike() | <STRIKE>old stuff</STRIKE> | |
"2".sub() | <SUB>2</SUB> | |
"2".sup() | <SUP>2</SUP> | |
"The Red Dog".toLowerCase() | the red dog | |
"The Red Dog".toUpperCase() | THE RED DOG |
Rick’s home page with index or
without
index
Last Updated: $Date: 2001/11/22 20:01:27 $ GMT ($Revision: 1.1 $)