为什么代码写完无法在慕课上实现
为什么代码写完无法看到效果,换到Dreamweaver 里面就可以运行。
为什么代码写完无法看到效果,换到Dreamweaver 里面就可以运行。
2015-12-29
这是慕课网的:
<!DOCTYPE html>
<html>
<head>
<title>prev + next选择器</title>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div>
码农家族
<label></label>
<p></p>
<label></label>
<label></label>
</div>
<label></label>
<script type="text/javascript">
$("p+label").css("background-color","red");
</script>
</body>
</html>
CSS样式:
div, p, label
{
float: left;
border: solid 1px #ccc;
margin: 5px;
padding: 5px;
}
p,label
{
width:230px;
height:30px;
}
p
{
border: solid 1px red;
}
这个在慕课网里面没有反应。当然,样式是外部链接式的,这里我就粘贴在后面了。
然后我把代码写到Dreamweaver里面就行了。
Dreamweaver的代码。是不是jquer库的原因?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="jquery-1.9.0.js"></script>
<style type="text/css">
div, p, label
{
float: left;
border: solid 1px #ccc;
margin: 5px;
padding: 5px;
}
p,label
{
width:230px;
height:30px;
}
p
{
border: solid 1px red;
}
</style>
</head>
<body>
<div>
码农家族
<label></label>
<p></p>
<label id="a"></label>
<label></label>
</div
<label></label>
<script type="text/javascript">
$("p+label").css("background-color","red");
</script>
</body>
</html>这是慕课网的:
<!DOCTYPE html>
<html>
<head>
<title>prev + next选择器</title>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div>
码农家族
<label></label>
<p></p>
<label></label>
<label></label>
</div>
<label></label>
<script type="text/javascript">
$("p+label").css("background-color","red");
</script>
</body>
</html>
CSS样式:
div, p, label
{
float: left;
border: solid 1px #ccc;
margin: 5px;
padding: 5px;
}
p,label
{
width:230px;
height:30px;
}
p
{
border: solid 1px red;
}
这个在慕课网里面没有反应。当然,样式是外部链接式的,这里我就粘贴在后面了。
然后我把代码写到Dreamweaver里面就行了。
Dreamweaver的代码。是不是jquer库的原因?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="jquery-1.9.0.js"></script>
<style type="text/css">
div, p, label
{
float: left;
border: solid 1px #ccc;
margin: 5px;
padding: 5px;
}
p,label
{
width:230px;
height:30px;
}
p
{
border: solid 1px red;
}
</style>
</head>
<body>
<div>
码农家族
<label></label>
<p></p>
<label id="a"></label>
<label></label>
</div
<label></label>
<script type="text/javascript">
$("p+label").css("background-color","red");
</script>
</body>
</html>
举报