【发布时间】:2016-08-13 18:38:05
【问题描述】:
我只是一个初学者,所以请放心
while (true){
//hide the paragraph
$("para").hide()
//show the paragraph slowly
$("para").show("slow")
}
p{
font-size:1500%;
text-align: center;
margin:0;
}
body{
background:yellow;
}
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="main.css">
</head>
<body>
<p id="para">this is disco</p>
</body>
<script src = "jquery.js"></script>
<script src = "main.js"></script>
</html>
jquery.js 是我计算机中压缩 jquery 的文件名,当我运行它时页面不显示
【问题讨论】:
-
while (true){无限循环... -
jquery.js 是否与您的 html 文件位于同一文件夹中?如果在加载时收到 404 错误,请检查浏览器的开发者工具。
-
使用
while (true)循环中的当前代码,它将始终执行并导致无限循环。 -
$("para")匹配<para>元素。你想要的是$("#para")来匹配元素与id="para"。
标签: javascript html css