=?gb2312?B?xOO6w6Oh?=
=? ?= 两个标记括起来
GB2312 是字符集
后面的一个 B 表示的是用的 Base64 编码
另一种方法是QP(Quote-Printable) 方法,通常缩写为“Q”方法,其原理是把一个 8 bit 的字符用两个16进制数值表示,然后在前面加“=”。所以我们看到经过QP编码后的文件通常是这个样子:=B3=C2=BF=A1=C7=E5=A3=AC=C4=FA=BA=C3=A3=A1。
实现鼠标经过显示层,鼠标离开不显示层的效果
几个关键点
1. position:relative、position:absolute
2. onmouseover、onmouseout
-------------------------
<style>
#DivCityFrame{ position: relative; z-index:20; }
#DivCity { position:absolute; top:15px; left:15px; width:200px; }
#DivCity { background:white; border:1px solid red; z-index:100; display:none;}
</style>
<div style="height:30px; background-color:#5507AA;"></div>
<table>
<tr>
<td width="300"></td>
<td>
<div id="DivCityFrame">
<span onmouseover="ShowDivCity();" onmouseout="HiddenDivCity();">显示城市</span>
<div id="DivCity" onmouseover="ShowDivCity();" onmouseout="HiddenDivCity();">
<ul><li>a</li><li>b</li><li>c</li><li>d</li></ul>
</div>
</td>
</tr>
</table>
<div style="height:30px; background-color:#5507AA;"></div>
<script>
function ShowDivCity()
{
document.getElementById("DivCity").style.display= "block";
}
function HiddenDivCity()
{
document.getElementById("DivCity").style.display = "none";
}
</script>
在用HttpWebRequest请求有些网页时,会发生“远程服务器返回错误: (501) 未实现。”
这个错误一般指服务器不支持HTTP方法所要求的客户。
可以试着给HttpWebRequest指定一个UserAgent。
如下:
httpWebRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; Potu-WebBrowser www.potu.com; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";
<style>
ul { width:500px; border:1px solid red; }
li { width:200px; float:left; }
</style>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>
这是在Firefox下
1.ul不指定高度
2.li指定了float属性
ul就会没有高度了,在IE和FF下会显示的不一样。
解决方法有三种
第一种:给ul属性 overflow:hidden;
第二种:给ul属性 float:left;
第三种
<style>
ul { width:500px; border:1px solid red; }
li { width:200px; float:left; }
</style>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<div style=" clear:both; visibility:hidden;">
</ul>
禁止浏览器从本地缓存中读取页面。
<meta http-equiv="pragram" content="no-cache">
<meta http-equiv="expires" content="0">
网页在缓存中的过期时间为0,一旦网页过期,必须从服务器上重新订阅。
用 align="absmiddle"
<img src="1.gif" align="absmiddle"/>
网站会员登陆机制
1.登录后,把用户信息写入在线用户表,并把 Username 和 Password 写入用户的 Cookie 中
2.访问页面时,读取 Cookie 中的 Username、Password,查询在线用户表,判断是否登录过
3.定时清理在线用户表中过期的用户
这样每次登陆用户访问页面时,只要查询在线用户表,不需要查询数据库中的用户表。
在线用户表是缓存表,不是一个数据表
C# 实现
InfoUser 类存放用户的信息
ArrayList 类中存放 InfoUser 类
当用户登录后,把用户的 InfoUser 类加入 ArrayList 类中,ArrayList 类是一个静态类
每次读取 Cookie 中的 Username、Password,再遍历 ArrayList 中的 InfoUser,如果配上,表示是登录用户。
<!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=gb2312" />
<title>DIV自适应宽度</title>
<style type="text/css">
<!--
.L { width:100px; background-color:blue; float:left;}
.R { width:100px; background-color:blue; float:right;}
.M { background-color:red; }
-->
</style>
</head>
<body>
<div style="width:500px;">
<div class="L">left:100px</div>
<div class="R">right:100px</div>
<div class="M">自适应宽度</div>
</div>
</body>
</html>
1.自适应宽度的层不要指定宽度和float属性
2.自适应宽度的层物理的位置放在最下面
DIV自适应高度
<!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=gb2312" />
<title>DIV自适应高度</title>
</head>
<style type="text/css">
.Panel { width: 500px; border:1px solid #222; overflow:hidden; }
.Panel .Left { width:200px; background-color:red; float:left; padding-bottom:30000px; margin-bottom:-30000px;}
.Panel .Right { width:300px; background-color:blue; float:right; padding-bottom:30000px; margin-bottom:-30000px; }
</style>
<body>
<div class="Panel">
<div class="Left"></div>
<div class="Right">1<br/>2<br/></div>
</div>
</body>
</html>
Left和Right是Panel下的两个子层,Right层高度不固定。实现Left和Right层的高度一样。
用padding-bottom:30000px; margin-bottom:-30000px;把子层拉高,再父层用overflow:hidden;遮蔽
DIV自适应宽度