📄 ch4_examp2.htm
字号:
<HTML>
<BODY>
<SCRIPT LANGUAGE=JavaScript>
var myString = "Welcome to Wrox books. "
myString = myString + "The Wrox website is www.wrox.com. "
myString = myString + "Visit the Wrox website today. Thanks for buying Wrox"
var foundAtPosition = 0;
var wroxCount = 0;
while ( foundAtPosition != -1)
{
foundAtPosition = myString.indexOf("Wrox",foundAtPosition);
if (foundAtPosition != -1)
{
wroxCount++;
foundAtPosition++;
}
}
document.write("There are " + wroxCount + " occurrences of the word Wrox");
</SCRIPT>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -