JAVA AJAX教程第二章-JAVASCRIPT基础知识
2009-10-27 00:00:00 来源:WEB开发网9 字符串搜索
程序代码
<script language=”JavaScript”>
<!--
var myVariable = “Hello there”;
var therePlace = myVariable.search(“there”);
document.write(therePlace);
// -->
</script>
10 字符串替换
程序代码
thisVar.replace(“Monday”,”Friday”);
11 格式化字串
程序代码
<script language=”JavaScript”>
<!--
var myVariable = “Hello there”;
document.write(myVariable.big() + “<br>”);
document.write(myVariable.blink() + “<br>”);
document.write(myVariable.bold() + “<br>”);
document.write(myVariable.fixed() + “<br>”);
document.write(myVariable.fontcolor(“red”) + “<br>”);
document.write(myVariable.fontsize(“18pt”) + “<br>”);
document.write(myVariable.italics() + “<br>”);
document.write(myVariable.small() + “<br>”);
document.write(myVariable.strike() + “<br>”);
document.write(myVariable.sub() + “<br>”);
document.write(myVariable.sup() + “<br>”);
document.write(myVariable.toLowerCase() + “<br>”);
document.write(myVariable.toUpperCase() + “<br>”);
var firstString = “My String”;
var finalString = firstString.bold().toLowerCase().fontcolor(“red”);
// -->
</script>
更多精彩
赞助商链接