本节内容:
javascript把小写字母依次变为大写
其实,这并不完全算是一个大小写转换程序,它主要是把文字按一定顺序依次变为小写的。
代码:
复制代码 代码示例:
<body OnLoad="rippleText()">
<SCRIPT LANGUAGE="JavaScript">
/**
* @小写字母依次变为大写
* @edit www.jb200.com
*/
ripplespeed = 300;
string = "javascript";
function rippleText() {
box = document.scrollform.box;
arg0 = rippleText.arguments[0];
i = (arg0) ? ( (arg0 == string.length) ? 0 : arg0) : 0;
box.value = string.substring(0,i)
+ (string.substring(i,i+1).toUpperCase())
+ string.substring(i+1, string.length);
scrollcmd = "rippleText("+(i+1)+")";
timer = window.setTimeout(scrollcmd, ripplespeed);
}
</script>
<center>
<form name=scrollform>
<input type=text name=box size=30>
</form>
</center>