<%@Language="Javascript"%>
<html>
<head>
<style>
.replyDiv{
border:1px solid #999;
}
.reply{
border:1px solid #ccc;
margin:5px;
}
</style>
</head>
<body>
<%
var conn = Server.CreateObject("ADODB.Connection");
var connStr = "Provider=Microsoft.Jet.Oledb.4.0;Data Source="+Server.MapPath("asfman.mdb");
conn.Open(connStr);
var Rs = Server.CreateObject("ADODB.RecordSet");
Rs.Open("select * from messages",conn,1,1);
while(!Rs.EOF)
{
for(var i = 0;i<Rs.Fields.Count;i++)
{
var temp = "";
if(Rs.Fields(i).Name == "reply")
{
temp = Rs.Fields(i).Value;
var arr = temp.match(/[^\f]+/g);
var str = arr.length? "<div class=\"replyDiv\">":"";
for(var j = 0;j<arr.length;j++)
{
str = str +"<div class=\"reply\">";
var arr2 = arr[j].match(/[^\b]+/g);
for(var k=0;k<arr2.length;k++)
{
str = str + (arr2[k]+"<br />");
}
str = str +"</div>";
}
str = str?(str+"</div>"):"";
}else
{
Response.Write(Rs.Fields(i).Value+"<br />");
}
}
Response.Write(str);
Rs.MoveNext();
}
Rs.Close();
conn.Close();
conn = null;
Rs = null;
%>
</body>
</html>
<%@Language="Javascript"%>
<%
var conn = Server.CreateObject("ADODB.Connection");
var connStr = "Provider=Microsoft.Jet.Oledb.4.0;Data Source="+Server.MapPath("asfman.mdb");
conn.Open(connStr);
var sql="insert into messages(name,content,ipAddress,reply,_time) values('asfman2','test','122','\f汪杰\b这是一个测试\b127.0.0.1\b2007-11-4\fasfman\bjust a test\b127.0.0.1\b2007-11-4',now())";
conn.Execute(sql);
Response.Write("ok");
%>
posted on 2007-11-04 01:30
汪杰 阅读(346)
评论(1) 编辑 收藏 引用 所属分类:
asp(javascrpt)