ENTER键可以让光标移到下一个输入框
<input οnkeydοwn="if(event.keyCode==13)event.keyCode=9">
MARK
Cookie中的数据以文本的形式存在客户端计算机,考虑它的安全性,最好在将数据存入Cookie之前对其进行加密。
加密的方法很多,比较简单一点的有:Base64,md5,sha等,而相对比较复杂一点的有:DES,TripleDES,RC2,Rijndael等。
下面是的代码实现了将数据存入Cookie之前采用散列的算法进行加密.
Private void Login_Click(object sender,System EventArgs e)
{
string Name = NameBox.Text;
string Pass = PassBox.Text;
Response.Cookies["name"].Value = FormsAuthentication.HashPasswordForStoringInConfigFile(Name, "md5");
Response.Cookies["pass"].Value = FormsAuthentication.HashPasswordForStoringInConfigFile(Pass, "md5");
}
加密的方法很多,使用比较复杂的加密算法,安全性比较高些,但占用服务器资源比较大,会减慢整个网站的访问速度。
所以对Cookie加密在考虑三个方面:1:安全性,2:Cookie容量,3:整个网站的性能。
FUNCTION fn_Split(@sText varchar(8000), @sDelim varchar(20) = ' ')
RETURNS @retArray TABLE (idx smallint Primary Key, value varchar(8000))
AS
BEGIN
DECLARE @idx smallint,
@value varchar(8000),
@bcontinue bit,
@iStrike smallint,
@iDelimlength tinyint
IF @sDelim = 'Space'
BEGIN
SET @sDelim = ' '
END
SET @idx = 0
SET @sText = LTrim(RTrim(@sText))
SET @iDelimlength = DATALENGTH(@sDelim)
SET @bcontinue = 1
IF NOT ((@iDelimlength = 0) or (@sDelim = 'Empty'))
BEGIN
WHILE @bcontinue = 1
BEGIN
--If you can find the delimiter in the text, retrieve the first element and
--insert it with its index into the return table.
IF CHARINDEX(@sDelim, @sText)>0
BEGIN
SET @value = SUBSTRING(@sText,1, CHARINDEX(@sDelim,@sText)-1)
BEGIN
INSERT @retArray (idx, value)
VALUES (@idx, @value)
END
--Trim the element and its delimiter from the front of the string.
--Increment the index and loop.
SET @iStrike = DATALENGTH(@value) + @iDelimlength
SET @idx = @idx + 1
SET @sText = LTrim(Right(@sText,DATALENGTH(@sText) - @iStrike))
END
ELSE
BEGIN
--If you can抰 find the delimiter in the text, @sText is the last value in
--@retArray.
SET @value = @sText
BEGIN
INSERT @retArray (idx, value)
VALUES (@idx, @value)
END
--Exit the WHILE loop.
SET @bcontinue = 0
END
END
END
ELSE
BEGIN
WHILE @bcontinue=1
BEGIN
--If the delimiter is an empty string, check for remaining text
--instead of a delimiter. Insert the first character into the
--retArray table. Trim the character from the front of the string.
--Increment the index and loop.
IF DATALENGTH(@sText)>1
BEGIN
SET @value = SUBSTRING(@sText,1,1)
BEGIN
INSERT @retArray (idx, value)
VALUES (@idx, @value)
END
SET @idx = @idx+1
SET @sText = SUBSTRING(@sText,2,DATALENGTH(@sText)-1)
END
ELSE
BEGIN
--One character remains.
--Insert the character, and exit the WHILE loop.
INSERT @retArray (idx, value)
VALUES (@idx, @sText)
SET @bcontinue = 0
END
END
END
RETURN
END
下面是调用示例:
declare @no char(100)
set @no='abc,cdesefd,efddc,mgns,aa'
select * from fn_Split(@no,',')
智能分割字符函数
把逗号去掉
能把些字分割为这样
嫦娥一号成功发射成功
分割为这样:
0 嫦
1 娥
2 一
3 号
4 成
5 功
6 发
7 射
8 成
9 功
====================================
关于WEB页的局部打印问题:
----------------------------------------
<script language="javascript">
<!--
function PrintNote()
{
var PrintWin=window.open('about:blank','Print');
PrintWin.document.write('<object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>' + document.all("PrintContent").innerHTML);
PrintWin.document.all.WebBrowser.ExecWB(7,1);
PrintWin.close();
}
-->
</script>
--------------------------------------------
内容用<div>装起来,并把DIV设置ID
<div id="PrintContent" align="center">
your GridView
</div>
------------------------------------
<input onclick="javascript:PrintNote();" type="button" value="打印" id="Button2" onserverclick="Button2_ServerClick" runat="server"/>
========================================================
让GridView产生纵向横向的滚动条。这样就不会吧页面撑打了。
-
CSS code
-
<style type="text/css" id="print" media="print"> #leftSide, #footerSide { display : none ; } </style> <style type="text/css" > .Freezing { position : relative ; table-layout : fixed ; top : expression(this.offsetParent.scrollTop) ; z-index : 10 ; } .Freezing th { text-overflow : ellipsis ; overflow : hidden ; white-space : nowrap ; padding : 2px ; } </style>
-
HTML code
-
< div id ="Div1" style ="overflow: scroll; height: 140px;width:638px" > Gridview 在这里 </ div >
-