To handle parameters in JavaScript:
<script>
function GetParam ()
{
urlinfo=window.location.href;//Get the URL of the current page
intlen= Urlinfo.length; Gets the length of the URL
offset=urlinfo.indexof ("?");//Set the position at which the parameter string begins
Strkeyvalue=urlinfo.substr (offset,len);//Fetch parameter string A string arrparam=strkeyvalue.split ("=") Like "id=1" is obtained here, and//the
argument string obtained is segmented according to "="
strparamvalue=arrparam[1]; Gets the parameter value
alert ("The parameter value you want to pass is" +strparamvalue);
}
</script>
Properties of string Strings objects in javascript:
length--returns the string length, not a function, and does not require parentheses.
prototype--Add properties and methods
There are some functions in JavaScript that handle string string objects:
Concat ()-combines the text of two or more characters to return a new string. (basically all are stitching themselves)
CharAt (a)-returns the character a at the specified position. (use less, but it feels very useful)
IndexOf (a)-returns the index of the first occurrence of a substring a in a string, or returns 1 if no match is made. (often used)
LastIndexOf (a)-returns the index of the last occurrence of a substring a in a string, or returns 1 if no match is made. (often used)
Match (REG)-checks whether a string matches a regular expression Reg. (is always very weak, seize the time to study well)
SUBSTRING (begin,end)-Returns a substring of a string with arguments containing both ends. (Note all lowercase)
SUBSTR (Start,length)-Returns a specified number of characters that are extracted from the start subscript from the string. (Don't confuse it with the one above)
Split (Separator,howmany)-separator is a string or regular expression (required), Howmany specifies the length of the array returned (optional)---commonly used
Replace (REGEXP/SUBSTR, replacement)-replacement character (very important)
toLowerCase () – Converts the entire string into lowercase letters.
toUpperCase () – Converts the entire string into uppercase letters.
The above JavaScript string object is a small series to share all the content, hope to give you a reference, but also hope that we support the cloud habitat community.