JavaScript字符处理

2016-05-25  本文已影响16人  71150ce14a00

字符串替换:

var str="Visit Microsoft!"

document.write(str.replace(/Microsoft/,"W3School"))

字符串长度:

str.length

字符串位置:

document.write(str.indexOf("M")

查找字符串中特殊字符

document.write(str.match("world") 

document.write(str.match("World") 

document.write(str.match("worlld") 

document.write(str.match("world!")

world null null  world!

var s = "aaa";

document.write(s.big());

document.write(s.small());

document.write(s.blink());

document.write(s.fontcolor('red'));

document.write(s.fontsize(5));

上一篇 下一篇

猜你喜欢

热点阅读