script09.js

来自「图灵程序设计丛书 JavaScript基础教程源代码」· JavaScript 代码 · 共 23 行

JS
23
字号
var pageCount = new Array(0,0,0,0);window.onload = initFrames;function initFrames() {	for (var i=0; i<document.links.length; i++) {		document.links[i].onclick = writeContent;		document.links[i].thisPage = i+1;	}}function writeContent() {	pageCount[this.thisPage]++;	var newText = "<h1>You are now looking at page " + this.thisPage;	newText += ".<br \/>You have been to this page ";	newText += pageCount[this.thisPage] + " times.<\/h1>";	var contentWin = document.getElementById("content").contentWindow.document;	contentWin.body.innerHTML = newText;	return false;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?