<html> <body> <button onclick="var myS = new String('www.java2java.com'); alert(myS.substr(4,7));"> substr </button> </body> </html>