9.toUpperCase() 把字符串转换为大写 let text = 'Hello world!'; console.log(text.toUpperCase())//HELLO WORLD! 10.toLowerCase() 把字符串转换为小写 let text = 'HELLO WORLD!'; console.log(text.toLowerCase())//hello world! 11.concat() 连接两个或多个字符串 concat() 方法可用于代替加运算...
h1 {text-transform: uppercase} p.uppercase {text-transform: uppercase} p.lowercase {text-transform: lowercase} p.capitalize {text-transform: capitalize} This Is An H1 Element Thisissome textina paragraph. Thisissome textina paragraph. Thisissome textina paragraph. 效果如下:...
JavaScript toLowerCase() 方法 JavaScript String 对象 定义和用法 toLowerCase() 方法用于把字符串转换为小写。 语法 string.toLowerCase() 浏览器支持 所有主要浏览器都支持 toLowerCase() 方法 实例 实例 把字符串转换为小写: var str="Hello World!"; document.write(str.toLowerCase()); 尝试一下 »...
toLowerCase() 方法用于把字符串转换为小写。 语法 stringObject.toLowerCase() 返回值 一个新的字符串,在其中 stringObject 的所有大写字符全部被转换为了小写字符。实例 在本例中,"Hello world!" 将以小写字母来显示: var str="Hello World!" document.write(str.toLowerCase()) TIY 如何使用 toLowerCase...
substring(0,4) //returns "exce" text.substring(2,4) //returns "ce" 13. substring(from, [to]) substring() 方法用于提取字符串中介于两个指定下标之间的字符,方返回的子串包括 start 处的字符,但不包括 stop 处的字符,to 可选,如果省略该参数,那么返回的子串会一直到字符串的结尾。 代码语言:...
<!-- function copy() { document.getElementById("t1").value=document.getElementById("t1").value.toLowerCase(); } //--> Enter text in Upper case or both <BR> Tutorial on onKeyUp() event handling → Here is the basic syntax for toLowerCase method...
JavaScript toLowerCase() 方法 JavaScript String 对象 定义和用法 toLowerCase() 方法用于把字符串转换为小写。 语法 string.toLowerCase() 浏览器支持 所有主要浏览器都支持 toLowerCase() 方法 实例 实例 把字符串转换为小写: <script> var str='Hello
//substring(from, to)vartext="excellent"text.substring(0,4)//returns "exce"text.substring(2,4)//returns "ce" 13. substring(from, [to]) substring()方法用于提取字符串中介于两个指定下标之间的字符,方返回的子串包括start处的字符,但不包括stop处的字符,to...
log('单词频率:', wordFrequency); /* 单词频率: { Welcome: 1, to: 1, the: 1, JavaScript: 1, world!: 1, Keep: 1, learning: 1, and: 1, coding!: 1 } */ // 将字符串拆分为句子,并计算句子数量 const sentences = text.split(/[.!?]/); const sentenceCount = sentences.length; ...
回到顶部(Back to Top) 1 JS事件 document.oncontextmenu // 右键菜单 document.onpaste //粘贴 document.oncopy //复制 document.oncut //剪切 document.onselectstart //选中开始时 + 触发时间为目标对象被开始选中时(即选中动作刚开始,尚未实质性被选中) + 基本上都能支持,但不被 input 和 textarea 标签支...