Blogger Information
Blog 87
fans 0
comment 0
visits 59711
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
第十一节课作业:美女相册
黄忠倚的博客
Original
1110 people have browsed it

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>实战:明星相册</title>
	<style type="text/css">
		.box {
			width: 500px;
			height: 700px;
			background-color: #efefef;
			border:1px solid lightgray;
			margin:20px auto;
			text-align: center;
			color: #636363;
			box-shadow: 2px 2px 2px #999;

		}
		.box ul {
			margin: 0;
			padding: 0;
			overflow: hidden;
		}
		.box ul li {
			list-style-type: none;
			float:left;
			background-color: skyblue;
			margin-left: 20px;
		}
		.box ul li a {
			display: block;
			width: 100px;
			height: 40px;
			line-height: 40px;
			color: white;
			text-decoration-line: none;
		}
		.box ul li a:hover {
			font-size:1.2em;
			background-color: coral; 
		}
		.box .pic {
			width: 450px;
			height: 470px;
			border:1px solid lightgray;
			line-height: 1px;
			margin: auto;
			margin-top: 50px;
		}
		.box .pic img {
			width: 100%;
			height: 100%;
		}


	</style>
</head>
<body><!-- 
	知识点:
	1、JS代码写在哪里?
	2、如何调用?
	3、函数的用法 -->
	<div class="box">
		<h2>美女相册</h2>
			<ul>
				<li><a href="./images/mm1.jpg" title="擅长技能《冰火毒龙》" onclick="changePic(this);return false;">1号美女</a></li>
				<li><a href="./images/mm2.jpg" title="擅长技能《空中飞人》" onclick="changePic(this);return false;">2号美女</a></li>
				<li><a href="./images/mm3.jpg" title="擅长技能《沙漠风暴》" onclick="changePic(this);return false;">3号美女</a></li>
				<li><a href="./images/mm4.jpg" title="擅长技能《一箭穿心》" onclick="changePic(this);return false;">4号美女</a></li>
			</ul>
		<div class="pic">
		<img src="./images/bg.jpg" alt="" id="img">
			<p id="info"></p>
		</div>	
	</div>
	<script type="text/javascript">
	// 1.获取一个美女图片与简介
	function changePic (pic){
		var picUrl = pic.href
		var picInfo = pic.title
		var picName = pic.innerHTML
		//2.
		var img = document.getElementById('img')
		var p = document.getElementById('info')
		//3将对应的占位符对象进行替换
		img.src = picUrl
		p.innerHTML = '<span style="color:coral">' + picName + ':' + picInfo + '</span>'

	}
	</script>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

作业地址:mi-888.com/php/zuoye/20180329/2.html

Correction status:Uncorrected

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post