In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "what are the uses of javascript classical functions", the content is simple and clear, and I hope it can help you solve your doubts. Let me lead you to study and learn this article "what are the uses of javascript classical functions?"
one. String substitution.
Function String_Replace (srcString,findString,replaceString) {
Return String_ReplaceB (srcString, findString, replaceString, 0)
}
Function String_ReplaceB (expression, find, replacewith, start) {
Var index = expression.indexOf (find, start)
If (index =-1)
Return expression
Var findLen = find.length
Var newexp = ""
Newexp = expression.substring (0, index) + (replacewith) + (expression.substring (index+findLen))
Return String_ReplaceB (newexp, find, replacewith, index+1+findLen)
}
two. The method of getting the length of string
Function String_GetLength (str) {
Var iMagne rtcm 0
For (iDeviso, i256) rt++
}
Return rt
}
three. Floating point method
Function getFloat (num)
{
Var num = parseFloat (num)
If (isNaN (num)) num = 0
Return num
}
four. The method of finding integers (using floating-point numbers)
Function getInt (num)
{
Return parseInt (getFloat (num))
}
five. Judge whether the text field object is empty or not
Function at_checkBlank (obj,caption) {
If (String_Replace (obj.value, ",") = ")
{
Obj.select ()
Alert (caption+ "cannot be empty")
Obj.focus ()
Return false
}
Return true
}
six. Two Select objects (llist,rlist) operate on each other
Var llist = item selected on the left side of fmObj.AssignedUser;//
Var rlist = unselected items on the right side of fmObj.WaitedUser;//
/ / double-click the item in the select on the right
Function Assignuser () {
If (rlist.selectedIndex
< 0 || rlist.selectedIndex >Rlist.options.length) return
Var i
Llist.options.length++
Llist.options[ llist.options.length-1] .value = rlist.options[ rlist.selectedIndex] .value
Llist.options[ llist.options.length-1] .text = rlist.options[ rlist.selectedIndex] .text
For (I = rlist.selectedIndex; I
< rlist.options.length - 1; i ++) { rlist.options[i].value = rlist.options[i+1].value; rlist.options[i].text = rlist.options[i+1].text; } rlist.length --; } //把右边选中的加入左边 function AssignRight_AssignSelected(){ for(var i = rlist.length - 1; i >= 0; I -) {
If (rlist.options [I] .selected) {
Llist.options.length++
Llist.options[ llist.options.length-1] .value = rlist.options[ I] .value
Llist.options[ llist.options.length-1] .text = rlist.options[ I] .text
For (var j = I; j
< rlist.options.length - 1; j ++) { rlist.options[j].value = rlist.options[j+1].value; rlist.options[j].text = rlist.options[j+1].text; } rlist.length --; } } } //把右边所有加入左边 function AssignRight_AssignAll(){ for(var i = rlist.length - 1; i >= 0; I -) {
Llist.options.length++
Llist.options[ llist.options.length-1] .value = rlist.options[ I] .value
Llist.options[ llist.options.length-1] .text = rlist.options[ I] .text
For (var j = I; j
< rlist.options.length - 1; j ++) { rlist.options[j].value = rlist.options[j+1].value; rlist.options[j].text = rlist.options[j+1].text; } rlist.length --; } } //左边select项目双击 function DenyUser() { if(llist.selectedIndex < 0 || llist.selectedIndex >Llist.options.length) return
Var i
Rlist.options.length++
Rlist.options[ rlist.options.length-1] .value = llist.options[ llist.selectedIndex] .value
Rlist.options[ rlist.options.length-1] .text = llist.options[ llist.selectedIndex] .text
For (I = llist.selectedIndex; I
< llist.options.length - 1; i ++) { llist.options[i].value = llist.options[i+1].value; llist.options[i].text = llist.options[i+1].text; } llist.length --; } //把左边选中的项目加入右边 function AssignRight_DenySelected() { for(var i = llist.length - 1; i >= 0; I -) {
If (llist.options [I] .selected) {
Rlist.options.length++
Rlist.options[ rlist.options.length-1] .value = llist.options[ I] .value
Rlist.options[ rlist.options.length-1] .text = llist.options[ I] .text
For (j = llist.selectedIndex; j
< llist.options.length - 1; j ++) { llist.options[j].value = llist.options[j+1].value; llist.options[j].text = llist.options[j+1].text; } llist.length --; } } } //左边所有项目加入右边 function AssignRight_DenyAll() { for(var i = llist.length - 1; i >= 0; I -) {
Rlist.options.length++
Rlist.options[ rlist.options.length-1] .value = llist.options[ I] .value
Rlist.options[ rlist.options.length-1] .text = llist.options[ I] .text
For (j = I; j < llist.options.length-1; j + +) {
Llist.options.value = llist.options.value
Llist.options [j] .text = llist.options [j + 1] .text
}
Llist.length--
}
}
These are all the contents of the article "what are the uses of javascript classic functions?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un