HTML 代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="Index.css">
<title>Info</title>
<script type="text/javascript">
function fn(name){
document.getElementById("link").src = name;
}
</script>
</head>
<body>
<div id="contain">
<div id="head">
<h1 align="center">Represent</h1>
</div>
<div id="list">
<a href="NewFile1.html" onclick='fn("NewFile1.html")'>file1</a><br>
<a href="NewFile2.html" onclick='fn("NewFile2.html")'>file2</a><br>
<a href="">nasdd</a>
</div>
<div id="fr">
<iframe id="link" align="left" src="about:blank" style="width: 78%;>
</iframe>
</div>
</div>
</body>
</html>
当我单击链接说“file1”时,会显示正确的 html,但不会在 iframe 中显示,而是显示为新页面。如何仅在框架中显示 html?