代码基本一致。却没效果显示 肿么回事?
帮我看看
xxxx.html:<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>欢迎来到HTML世界</title>
<link href="0008.css" rel="stylesheet">
</head>
<body>
<div id="container">
<h1>我爱鱼C</h1>
<p>www.Fish.com - 让编程改变世界</p>
<a href="http://bbs.fishc.com/forum-337-1.html" id="first_Js">传送门</a>
</div>
<script src="first_Js.js"></script>
</body>
</html>
xxxx.css:/*用来制定样式文件的编码格式*/
@charset "UTF-8";
html,body{
height: 100%;
color: #0000ff;
font-family: 思源宋体;
}
body{
background: url(background.jpg) center center;
background-size: cover;
margin: 0; /*养成初始化好习惯*/
padding: 0;
position: relative;
}
#container{
width: 100%;
text-align: center;
position: absolute;
top: 50%;
transform: translateY(-50%); /*不同浏览器的transform,是不一样的,-ms-、 -moz-、后续详细介绍*/
}
h1{
font-size: 33px;
margin-bottom: 22px;
}
p{
font-size: 22px;
margin-bottom: 22px;
}
a{
text-decoration: none;
padding: 8px 44px;
background: #7700ff;
color: #fff;
border: 1px solid #7700ff;
border-radius: 3px;
font-size: 18px;
}
first.Js.js: var first_Js = document.getElementById("first_Js");
first_Js.onclick = function(e)
{
e.preventDefault();
first_Js.innerHTML = "穿越成功";
}
|