超链接打开目标(target)的测试-XHTML教程

来源:模板无忧 作者:木子屋dnawo 更新时间:2007-12-10 点击:
链接的target属性决定了链接在哪边打开,它的值通常为以下五种:_blank、_self、_parent、_top和自定义,依次表示为:新窗口、当前窗口、父窗口、顶层窗口和框架。当所指名称的框架不存在时,自定义作用等同于_blank。今天我们主要测试一下当所指名称的框架处于不同层次页面中或不同层次页面中都有该名称框架时链接在哪个框架中打开?

一、测试

1.测试一:指定名称的框架处于不同层次页面中

index.htm:
<iframe name="frame1" src="" width="400" height="400"></iframe>
<iframe src="aaa.htm" width="400" height="400"></iframe>

aaa.htm:
<iframe name="frame2" src="bbb.htm" width="300" height="300"></iframe>
<a href="http://www.mb5u.com/" target="frame1">Links</a>

bbb.htm:
<iframe name="frame3" src="" width="200" height="200"></iframe>

测试结果:
当target="frame1"时,在index.frame1中打开;(为方便说明,框架位置统一用"页面名称.框架名称"格式)
当target="frame2"时,在aaa.frame2中打开;
当target="frame3"时,在bbb.frame3中打开;

2.测试二:不同层次页面中存在同名称的框架

index.htm:
<iframe name="frame1" src="" width="400" height="400"></iframe>
<iframe src="aaa.htm" width="400" height="400"></iframe>

aaa.htm:
<iframe name="frame2" src="bbb.htm" width="300" height="300"></iframe>
<a href="http://www.mb5u.com/" target="frame2">Links</a>

bbb.htm:
<iframe name="frame2" src="" width="200" height="200"></iframe>

测试结果:
当target="frame2"时,在aaa.frame2中打开;

3.测试三:不同层次页面中存在同名称的框架

index.htm:
<iframe name="frame2" src="" width="400" height="400"></iframe>
<iframe src="aaa.htm" width="400" height="400"></iframe>

aaa.htm:
<iframe name="frame2" src="bbb.htm" width="300" height="300"></iframe>
<a href="http://www.mb5u.com/" target="frame2">Links</a>

bbb.htm:
<iframe name="frame3" src="" width="200" height="200"></iframe>

测试结果:
当target="frame2"时,在aaa.frame2中打开;

4.测试四:不同层次页面中存在同名称的框架



index.htm:
<iframe name="frame1" src="" width="400" height="400"></iframe>
<iframe src="aaa.htm" width="400" height="400"></iframe>
< Prev12 Next >
相关XHTML教程:
最新评论:
loading.. 评论加载中....
发表评论:不能超过250字节,请自觉遵守互联网相关政策法规.
  • 昵称: 验证:

最新XHTML教程