首页 > 其他 > 详细

深入理解热区链接

时间:2015-03-27 08:56:51      阅读:209      评论:0      收藏:0      [点我收藏+]


以我的理解热区链接可以当成是在一个图片或图案上的自己定义一个固定的位置,当鼠标点击时,会产生链接,比如打开一个新的页面。所以热区链接目的就是要在图片上做文章!

这样我们就可以以图片的形式展开对于热区链接的叙述了。

一般我们使用热区链接就三大块1、要先定义要使用图片的名字如

                                                        2、导入要使用的图片

                                                        3、定义要使用图片应产生链接的位置

下面这两幅图是大概地向大家展示一下效果。注意看图中的注释。

<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	
	<map name="lin"><!--这是先定义要使用图片的名字-->
		<img src="8.jpg" usemap="#lin" alt="" /><!--这是导入要使用的图片-->
		<area shape="circle" coords="0,0,60" href="http://www.baidu.com" alt="" target="lin" ><!--这是定义要使用图片应产生链接的位置-->
    </map>
</body>
</html>


技术分享

显然可以看见网页里会有个蓝色的1/4圆产生,这是由于定义了热区链接,当点击那个圈时会直接在新页面打开链接的网址。

接下来具体介绍 要使用图片应产生链接的位置

也就是这一段代码    

<area shape="circle" coords="0,0,60" href="http://www.baidu.com" alt="" target="lin" >
shape表示定义热区图案形状,有三种  圆形:circle多变形:polygon矩形:rectagle

href后面跟了点击热区将会打开的新网页,所以可以随意设置地址

coords代表了定义点的坐标,由于对于不同形状会有不同区分,分三种

圆形时:(x,y,z)

多边形:(x1,y1,x2,y2,x3,y3.............)

矩形:(x1,y1,x2,y2)

以下我把三种不同形状的时候都写一下

<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<map name="lin">
		<img src="8.jpg" usemap="#lin" alt="" />
		<area shape="polygon"  coords="20,20,100,100" href="http://www.baidu.com" alt="" target="lin" />
    </map>  
</body>
</html>

矩形的效果图

技术分享


<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<map name="lin">
		<img src="8.jpg" usemap="#lin" alt="" />
		<area shape="rectangle"  coords="503,45,577,45,616,84,616,184,503,184" href="http://www.baidu.com" alt="" target="lin" />
    </map>  
</body>
</html>

多变形效果图

技术分享


<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<map name="lin">
		<img src="8.jpg" usemap="#lin" alt="" />
		<area shape="circle"  coords="90,90,90" href="http://www.baidu.com" alt="" target="lin" />
    </map>  
</body>
</html>

圆形效果图

技术分享



下面有一种好玩的方式,新的页面将会在原页面的一个框架里打开

<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<map name="lin">
		<img src="8.jpg" usemap="#lin" alt="" />
		<area shape="circle"  coords="90,90,90" href="http://www.baidu.com" alt="" target="lin" />
		<iframe name="lin" src="http://www.csdn.com" width="600" height="400" frameboard="1" ></iframe>
    </map>  
</body>
</html>

效果图

技术分享

有关iframe可以看我的另外一篇博客《邮件链接》

                              

深入理解热区链接

原文:http://blog.csdn.net/qq_24928451/article/details/44656739

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!