◎_blank,在新浏览器窗口中打开链接文件。
◎_parent,将链接的文件载入含有该链接框架的父框架集或父窗口中。如果含有该链接的框架不是嵌套的,则在浏览器全屏窗口中载入链接的文件,就象_self参数一样。
◎_self,在同一框架或窗口中打开所链接的文档。此参数为默认值,通常不用指定。
但是我不太理解
◎_top,在当前的整个浏览器窗口中打开所链接的文档,因而会删除所有框架。
补充一点:target=mainName
将mainName换成你的目标文件的标识,将会在目标框架中显示.
2、框架的例子:
首先:frame.html
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>定义框架的例子</title>
</head>
<frameset framespacing="1" border="1" bordercolor=#333399 frameborder="yes">
<frameset cols="150px,*">
<frame name="left" target="main" src="c.html" scrolling="auto" frameborder=1>
<frame name="main" src ="b.html" scrolling="auto" noresize frameborder=1>
</frameset>
<noframes>
<body>
<p>此网页使用了框架,但您的浏览器不支持框架。</p>
</body>
</noframes>
</frameset>
</html>
解析:target="main"目标文件的标识,将会在目标框架(<frame name="main" >)中显示。即框架left中c.html就在框架left中显示,而c.html中的(
<a href="a.html"target="main">a.html</a>
</br>
<a href="b.html" target="main">b.html </a>)a.html和b.html会在main框架中显示。因为他们都有名叫main的标识。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<title> HTML内容标题</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<a href="a.html"target="main">a.html</a>
</br>
<a href="b.html" target="main">b.html </a>
</body>
</html>
再者:a.html页面
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<title> HTML内容标题</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<h1>a.html</h1>
</body>
</html>
b.html页面
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<title> HTML内容标题</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<h1>b.html</h1>
</body>
</html>
运行结果展示:
3、框架的演示(结合js):
首先Frame1.html的代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<frameset cols="159px,*">
<frame name="a1" src="link.html" noresize="yes" border="1px" scrolling="auto" bordercolor="blue" >
<frame name="a2" src="firstPage.html">
</frameset>
</html>
其次、link.html的代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<style type="text/css">
<!--
*{margin:0;padding:0;border:0;}
body {
font-family: arial, 宋体, serif;
font-size:12px;
}
#nav {
width:180px;
line-height: 24px;
list-style-type: none;
text-align:left;
/*定义整个ul菜单的行高和背景色*/
}
/*==================一级目录===================*/
#nav a {
width: 160px;
display: block;
padding-left:20px;
/*Width(一定要),否则下面的Li会变形*/
}
#nav li {
background:#CCC; /*一级目录的背景色*/
border-bottom:#FFF 1px solid; /*下面的一条白边*/
float:left;
/*float:left,本不应该设置,但由于在Firefox不能正常显示
继承Nav的width,限制宽度,li自动向下延伸*/
}
#nav li a:hover{
background:#CC0000; /*一级目录onMouseOver显示的背景色*/
}
#nav a:link {
color:#666; text-decoration:none;
}
#nav a:visited {
color:#666;text-decoration:none;
}
#nav a:hover {
color:#FFF;text-decoration:none;font-weight:bold;
}
/*==================二级目录===================*/
#nav li ul {
list-style:none;
text-align:left;
}
#nav li ul li{
background: #EBEBEB; /*二级目录的背景色*/
}
#nav li ul a{
padding-left:10px;
width:160px;
/* padding-left二级目录中文字向右移动,但Width必须重新设置=(总宽度-padding-left)*/
}
/*下面是二级目录的链接样式*/
#nav li ul a:link {
color:#666; text-decoration:none;
}
#nav li ul a:visited {
color:#666;text-decoration:none;
}
#nav li ul a:hover {
color:#F3F3F3;
text-decoration:none;
font-weight:normal;
background:#CC0000;
/* 二级onmouseover的字体颜色、背景色*/
}
/*==============================*/
#nav li:hover ul {
left: auto;
}
#nav li.sfhover ul {
left: auto;
}
#content {
clear: left;
}
#nav ul.collapsed {
display: none;
}
-->
#PARENT{
width:180px;
}
*#PARENT{
width:100%;
}
</style>
<div id="PARENT">
<ul id="nav">
<li><a href="#Menu=ChildMenu1" οnclick="DoMenu('ChildMenu1')">我的网站</a>
<ul id="ChildMenu1" class="collapsed">
<li><a href="firstPage.html" target="a2">第一个页面</a></li>
<li><a href="secondPage.html" target="a2">第二个页面</a></li>
</ul>
</li>
<li><a href="#Menu=ChildMenu2" οnclick="DoMenu('ChildMenu2')">我的帐务</a>
<ul id="ChildMenu2" class="collapsed">
<a href="#">支付</a></li>
<li><a href="#">管理</a></li>
<li><a href="#">网上支付</a></li>
<li><a href="#">登记汇款</a></li>
<li><a href="#">在线招领</a></li>
<li><a href="#">历史帐务</a></li>
</ul>
</li>
<li><a href="#Menu=ChildMenu3" οnclick="DoMenu('ChildMenu3')">网站管理</a>
<ul id="ChildMenu3" class="collapsed">
<li><a href="#">登录</a></li>
<a href="#">角色管理</a></li>
<li><a href="#">用户管理</a></li>
</ul>
</li>
</ul>
</div>
<script type=text/javascript>
<!--
var LastLeftID = "";
function menuFix() {
var obj = document.getElementById("nav").getElementsByTagName("li");
for (var i=0; i<obj.length; i++) {
obj[i].οnmοuseοver=function() {
this.className+=(this.className.length>0? " ": "") + "sfhover";
}
obj[i].onMouseDown=function() {
this.className+=(this.className.length>0? " ": "") + "sfhover";
}
obj[i].onMouseUp=function() {
this.className+=(this.className.length>0? " ": "") + "sfhover";
}
obj[i].οnmοuseοut=function() {
this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
}
}
}
function DoMenu(emid)
{
var obj = document.getElementById(emid);
obj.className = (obj.className.toLowerCase() == "expanded"?"collapsed":"expanded");
if((LastLeftID!="")&&(emid!=LastLeftID)) //关闭上一个Menu
{
document.getElementById(LastLeftID).className = "collapsed";
}
LastLeftID = emid;
}
function GetMenuID()
{
var MenuID="";
var _paramStr = new String(window.location.href);
var _sharpPos = _paramStr.indexOf("#");
if (_sharpPos >= 0 && _sharpPos < _paramStr.length - 1)
{
_paramStr = _paramStr.substring(_sharpPos + 1, _paramStr.length);
}
else
{
_paramStr = "";
}
if (_paramStr.length > 0)
{
var _paramArr = _paramStr.split("&");
if (_paramArr.length>0)
{
var _paramKeyVal = _paramArr[0].split("=");
if (_paramKeyVal.length>0)
{
MenuID = _paramKeyVal[1];
}
}
}
if(MenuID!="")
{
DoMenu(MenuID)
}
}
GetMenuID(); //*这两个function的顺序要注意一下,不然在Firefox里GetMenuID()不起效果
menuFix();
-->
</script>
再者、firstPage.html的代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<title>第一个页面</title>
<style>
</style>
</head>
<body>
<h1>第一个页面</h1>
</body>
</html>
结果为:
该示例有参考相关链接:
http://www.jb51.net/web/17402.html
4、html基础标签的演示
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<title> HTML内容标题</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body bgcolor="#00FFFF" >
<font face="黑体" size="4"></font>
<!--HTML文件内容-->
<!--img border ="0" dynsrc="hh.swf" start="fileopen" width="321" height="321"-->
<a name="top" id="top"></a>
<a href="https://www.baidu.com" >在相同打开百度网站</a>
<a href="https://www.baidu.com" target="_bank"> 在新窗口打开百度网站</a>
<a href="https://www.baidu.com" target="_parent"> 在父框架打开百度网站</a>
<a href="https://www.baidu.com" target="_self"> 在相同打开百度网站</a>
<a href="mailto:xujingxuxue123@sina.com">我的邮箱</a>
<p align="center"><b>加粗</b> <i>倾斜</i> <u>下划线</u></p>
<h1>这是标题1</h1>
<h2>这是标题2</h2>
<h3>这是标题3</h3>
<h6>这是标题6</h6>
<h1>这是标题1</h1>
<h2>这是标题2</h2>
<h3>这是标题3</h3>
<h1>这是标题1</h1>
<h2>这是标题2</h2>
<h3>这是标题3</h3>
<h6>这是标题6</h6>
<h1>这是标题1</h1>
<h2>这是标题2</h2>
<h6>这是标题6</h6>
<h1>这是标题1</h1>
<h2>这是标题2</h2>
<h3>这是标题3</h3>
<h6>这是标题6</h6>
<h1>这是标题1</h1>
<h2>这是标题2</h2>
<h3>这是标题3</h3>
<h6>这是标题6</h6>
<a href="#top">返回到name=top顶部</a>
<table width ="200" border="1">
<tr>
<td > </td>
<td > </td>
<td > </td>
</tr>
<tr>
<td > </td>
<td > </td>
<td > </td>
</tr>
<tr>
<td > </td>
<td > </td>
<td > </td>
</tr>
</table>
<table border="1" width="100%" id="table1">
<tr>
<td colspan="2" bgcolor="#C0C0C0">
<p align="center">表格</td>
</tr>
<tr >
<td bgcolor="#C0C0C0"><p align="center">域名</td>
<td bgcolor="C0C0C0"><p align ="center">说明</td>
</tr>
</table>
</body>
</html>
效果展示:
解决的问题:为什么自己写的网页一运行到Chrome上中文就显示的是乱码呐?
解决:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<title>......</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
</body>
</html>