For the slice function of the array object,
Returns an array. (Still an array)
Arrayobj. Slice (START, [end])
Parameters
Arrayobj
Required. An array object.
Start
Required. The starting element of the part specified in arrayobj is the subscript calculated from scratch.
End
Optional. The ending element of the part specified in arrayobj is the subscript calculated from scratch.
Description
The Slice Method returns an array object, which contains the specified part of arrayobj.
The Slice Method is always copied to the end specified element, but this element is not included. If start is negative, it is processed as Length + start. Here, length is the length of the array. If end is negative, it is processed as Length + end. Here, length is the length of the array. If end is omitted, the slice method will always be copied to the end of arrayobj. If end appears before start, no elements are copied to the new array.
Example
In the following example, all elements in myarray are copied to newarray except the last element:
Newarray = myarray. Slice (0,-1)
-------- STR slice
<SCRIPT type = "text/JavaScript">
Function request (valuename, testurl)
{
VaR rtnval;
// Obtain the current webpage address. http: // 192.168.1.240: 85/test/asp/crmkorea_co_kr/test.htm? Para1 = atest
// Var nowaddress = Unescape (location. href );
VaR nowaddress = testurl
VaR parameters = new array ();
Alert (nowaddress. Slice (nowaddress. indexof ("? ") + 1, nowaddress. Length ))
Parameters = (nowaddress. Slice (nowaddress. indexof ("? ") + 1, nowaddress. Length). Split ("&");
For (VAR I = 0; I <parameters. length; I ++)
{Alert (I + "--" + parameters [I])
If (parameters [I]. indexof (valuename )! =-1)
{
Rtnval = parameters [I]. Split ("=") [1];
If (rtnval = undefined | rtnval = NULL)
{
Rtnval = "";
}
Return rtnval;
}
Else {
// Alert (parameters [0]. indexof (valuename ))
// Alert ("request must from:" + valuename)
}
}
Return ""
// Alert (rtnval );
}
VaR myaddr = "http://www.HCSTID.com /? Para1 = test1 & para1 = Test2"
Alert (Request ("para1", myaddr )) // Check whether the address contains the para1 parameter and return the value of this parameter.
</SCRIPT>