<HTML> <HEAD> <TITLE>String Slicing and Dicing, Part I</TITLE> <SCRIPT LANGUAGE="JavaScript"> var mainString = "This is a test" function showResults() { var form = document.forms[0] var param1 = 2; var param2 = 3; if (!param2) { alert( mainString.slice(param1)); } else { alert( mainString.slice(param1, param2)); } } </SCRIPT> </HEAD> <BODY onLoad="showResults()"> </BODY> </HTML>
Related Scripts with Example Source Code in same category :