📄 例4-13.txt
字号:
文件4-13main.html:
<html><head><title>anchors数组示例</title></head>
<frameset cols="30%,*">
<frame src="ch4-13-anchor1.html">
<frame src="ch4-13-anchor2.html" name="anchors2">
</frameset></html>
文件ch4-13-anchor1.html:
<html><head><title>anchors:frame 1</title></head>
<body><script>
function linkToAnchor(num){
if (parent.anchors2.document.anchors.length>=num)
parent.anchors2.location.hash=num
else
alert("目标不存在!");
}
</script>
单击以下按钮可跳转到需要的目标:<br><br>
<form><input type="button" value="目标0"
name="anch0" onclick="linkToAnchor(0)"><br>
<input type="button" value="目标1" name="anch1" onclick="linkToAnchor(1)"><br>
<input type="button" value="目标2" name="anch2" onclick="linkToAnchor(2)"><br>
<input type="button" value="目标3" name="anch3" onclick="linkToAnchor(3)">
</form></body></html>
文件ch4-13-anchor2.html:
<html><head><title>anchors:frame 2</title></head>
<body><p><a name="0"><b>Some persons</b></a>
<ol><li>Li Ming<li>Wang Lin<li>Zhang Shan<li>Zhu Yun<li>Ma Li<li>Lei Feng
</ol></p>
<p><a name="1"><b>Some countries</b></a>
<ul><li>China<li>Canada<li>U.S.A<li>Japan<li>Brazil</ul></p>
<p><a name="2"><b>Some colors</b></a>
<ul><li>red<li>bule<li>green<li>yellow<li>gray</ul></p>
<p><a name="3"><b>Some courses</b></a><ol><li>Data Structure and Programming
<li>Operating System<li>Computer Networks<li>Artificial Intelligence</ol></p>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -