日期:2014-05-16  浏览次数:20332 次

请问,target属性?

<html >
<head >
<title></title>
</head>
<frameset cols="25%,75%">
   <frame name = "熊俊" src="http://www.QQ.com">
   <frame src="http://www.QQ.com">
</frameset>
<body>
<a href = "http://www.baidu.com" target = "熊俊">fgf</a>
</body>
</html>


在《JavaScript权威指南》的14.8.2节中讲到:当用HTML 标记<frame>创建帧时,可以使用属性name为这个帧指定一个名字。给窗口或者帧 指定名字的一个重要原因是那个名字可以用作标记<a>或<form>的属性target的值。 这样就可以告诉浏览器把激活链按或者提交表单的结果显示在哪里。

但是,上面的代码却报错:此特性允许的值不包括"熊俊"。这是为什么呢?

------解决方案--------------------
<frameset cols="25%,75%">
   <frame name = "熊俊" src="http://www.QQ.com">
   <frame src="a.html">
</frameset>
你在a.html里试试<a href = "http://www.baidu.com" target = "熊俊">fgf</a>
------解决方案--------------------
不会是因为编码原因吧,楼主改成utf-8试试
------解决方案--------------------

<html >
<head >
<title></title>
</head>
<frameset cols="25%,75%">
   <frame name = "熊俊" src="http://www.QQ.com">
   <frame src="http://www.QQ.com">
</frameset>
<body>
<a href = "http://www.baidu.com" target = "熊俊">fgf</a>
</body>
</html>

frameset 不像 iframe ,就是在总的控制页面不能调用页面的跳转,而这个包含有frameset的是总页面,要跳转也是在子页面内跳转。比如

<frame name = "top" src="top.html">
<frame name="bottom" src="bottom.html">

在bottom.html中:

<a href = "middle.html" target = "top">middle</a>

这样的话,在name为top的这个区域将会被middle这个html会代替。
如果你不想这样,或页面架构不是这个样子,那就直接采用iframe或许更为灵活或方便。
------解决方案--------------------
name 用英文试试
------解决方案--------------------
大哥,你这样能看到body里面的东西?我这根本看不到。不带这样写的吧。body和frameset只能选一个

------解决方案--------------------
我试过了 没问题,打开了2个页面,左右布置
------解决方案--------------------
引用:
引用:XML/HTML code?123456789101112<html ><head ><title></title></head><frameset cols="25%,75%">   <frame name = "熊俊" src="http://www.QQ.com">   <frame src="http://www.QQ.c……

我在前面回帖中就说了,

如果你不想这样,或页面架构不是这个样子,那就直接采用iframe或许更为灵活或方便。

frame 是frameset 的子元素,只能放在framset下面,而且dtd是有frameset标识的。
------解决方案--------------------
引用:
大哥,你这样能看到body里面的东西?我这根本看不到。不带这样写的吧。body和frameset只能选一个


frameset浏览器支持的话body标签就被忽略掉,否则才会显示body的内容,参考csdn首页

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">