我完全被卡住了。我所有的html文档都经过了验证,并且被正确引用,但是当我加载主html时,它不会呈现。是否有我的HTML不呈现的原因?
我的目标是有一个两面的页面:左侧显示默认图像和标题,右侧包括一个按钮,用于加载五个不同的随机图像和左侧的标题通过不同的HTML文件。
我与“iframes”有不同的方面。
另外如何改变iframes的宽度?
<!DOCTYPE html>
<html>
<head>
<title>Free Jokes!</title>
<meta charset="utf-8">
<meta name="author" content="Justin Partovi, CS80 1184, Summer 2013">
<link href="final%20project.css" rel="stylesheet">
</head>
<body>
<h1 id="shadow">Welcome to Free Jokes!</h1>
<iframe id="left" src="left.html"></iframe>
<iframe id="right" src="right.html"></iframe>
</body>
</html>
左侧:
(请让我知道,如果有更好的方式来完成我的目标除了我现在正在做的方式)
<!DOCTYPE html>
<html>
<head>
<title>Your Joke!</title>
<meta charset="utf-8">
<script>
var randomnumber
function clickForJoke() {
randomnumber=math.floor(1 + Math.random() * 15);
switch (randomnumber) {
case 1:
window.open("joke1.html", target="right");
break;
case 2:
window.open("joke2.html", target="right");
break;
case 3:
window.open("joke3.html", target="right");
break;
case 4:
window.open("joke4.html", target="right");
break;
case 5:
window.open("joke5.html", target="right");
break;
default:
window.open("joke.html", target="right");
</script>
</head>
</html>
右侧:
(我做出的正确按钮?)
<!DOCTYPE html>
<html>
<head>
<title>Final project</title>
<meta charset="utf-8">
<link href="final%20project.css" rel="stylesheet">
</head>
<body>
<button type="button" id="jokeButton" name="jokeButton" onclick="clickForJoke">Click for your joking pleasure!</button>
</body>
</html>
的默认图像和阳离子:
<html>
<head>
<title>Default joke</title>
<meta charset="utf-8">
<link href="final%20project.css" rel="stylesheet">
</head>
<body>
<p><img alt src = "laughing%20gif.gif"></p>
<p><b>Click the button to the right to get a free joke!</b></p>
</body>
</html>
我没有做其他五个HTML文档呢。
这里有多种问题,第一个是您要访问的是其他'iframe'功能这是不允许的,第二个函数语法是错误的 - 你缺少'}}'末尾 –
你想在左侧面板中打开joke.html –
是的。这是我的意图。我该怎么办? – user2617514