首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

请教,target属性

2013-01-26 
请问,target属性?html head title/title/headframeset cols25%,75%frame name 熊俊 s

请问,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">


<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>CSDN论坛首页 - CSDN.NET</title>
    <script src="/assets/application-1a33bfd3d5ee7e433197442aeb9c03b6.js" type="text/javascript"></script>
    <script type="text/javascript">
      $(function() {
        main_page_js.index_page();
      });
    </script>
    <link href="http://csdnimg.cn/www/images/favicon.ico" rel="SHORTCUT ICON">

  </head>
  <frameset cols="230,*" frameborder="no" border="0" framespacing="0">
    <frame src="/left_menu" name="leftFrame"  noresize="noresize" id="leftFrame" title="leftFrame" />
    <frame src="/home" name="mainFrame" id="mainFrame" title="mainFrame" />
  </frameset>
  <noframes>
    <body>
    </body>
  </noframes>
</html>

[解决办法]
谢谢 showbo!

热点排行