{
this.lblNote.Text = “搜索关键字为:” + this.txtContent.Text;
}
三、附注
1、使用encodeURIComponent代替 escape的原因
escape() 只是为 ASCII字符 做转换工作,转换成的 %unnnn 这样的码,如果要用更多的字符如 UTF-8字符库 就一定要用 encodeURIComponent() 或 encodeURI() 转换才可以成 %nn%nn 这的码才可以escape() 只是为 ASCII字符 做转换工作,转换成的 %unnnn 这样的码,如果要用更多的字符如 UTF-8字符库 就一定要用 encodeURIComponent() 或 encodeURI() 转换才可以成 %nn%nn 这的码才可以。
来源:请参见http://www.misuisui.com/weblog/?p=418
2、网上有一篇是使用Javascript实现的,具体代码为:
<%@ Page Language=”C#” AutoEventWireup=”true” Codebehind=”DragSearch.aspx.cs” Inherits=”CanYou.AutoComplete.Web.DragSearch” %>
<!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 runat=”server”>
<title>划词搜索</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″ />
</head>
<body>
<form id=”form1″ runat=”server”>
<div style=”text-align: center;”>
<input type=”button” onclick=”isallow()” value=”关闭/打开划词功能” />
<p>
《红楼梦》是我国古代四大名著之一,属章回体长篇小说,成书于1784年(清乾隆帝四十九年)。梦觉主人序本正式题为《红楼梦》,它的原名《石头记》、《情僧录》、《风月宝鉴》、《金陵十二钗》等。是我国古代最伟大的长篇小说,也是世界文学经典巨著之一。作者曹雪芹。现通行的续作是由高鹗续全的一百二十回《红楼梦》。
</p>
<p>
if you want to search,one way is to Google,one of the others is Baidu</p>
</div>
<!–不足之处:英文语句的,传参不够完整–>
</form>
</body>
</html>
<script type=”text/javascript” language=”javascript”>
<!–
document.body.onload=adddiv;
document.onmousedown=recordobj;
document.ondblclick=dbclick;
document.onmouseup=showselect;
var starobj,isdb=false,allow=true;
function isallow()
{
if(allow){
allow=false;
alert(‘is closed’);
}
else{
allow=true;
alert(‘is opened’);
}
}
//ondblclick
function dbclick()
{
isdb=true;
}
//onmousedown
function recordobj()
{
starobj=event.srcElement;
}
//onmouseup
function showselect() {










