通常我们在做网站开发的时候对于超链接的使用通常是如下的方式:
<a href=http://www.ecoveiws.cn>碧水轩</a>
看看超链接嵌套的一种情形:
点击进入<a href=”http://www.google.com”>谷歌网站和<a href=”http://www.baidu.com“>百度网站</a></a>
在上面的代码中,在一个<a> 和</a>之间又存在了一个<a></a>你说浏览器(IE和Firefox)是怎么执行的呢?
看看网站的程序代码:
<!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>
</head>
<style type=”text/css”>
a:hover
{
text-decoration:none;
color:#FF0000;
}
</style>
<body>
点击进入<a href=”http://www.google.com“>谷歌网站和<a href=”http://www.baidu.com“>百度网站</a></a>
</body>
</html>
其执行的结果为:
IE:点击进入谷歌网站和百度网站 点击进入谷歌网站和百度网站
Firefox:点击进入谷歌网站和百度网站 点击进入谷歌网站和百度网站
从执行的几个来看,我们可以发现IE浏览器与Firefox浏览器在解释<a标签时的相同之处,他们均是通过<a href来判断一个超链接的,而对于是否有</a>并不在意!关键是<a href=”">后面的文字才重要,那是链接的承载体。
如:<a href=http://www.baidu.com>百度<a href=http://www.google.cn>谷歌</a></a>,百度与谷歌均能链接。
但是::<a href=http://www.baidu.com><a href=http://www.google.cn>谷歌</a></a>,却只有谷歌才能链接。
相关文章:
Comments
Leave a comment Trackback