留言板html模板源代码(html表单留言板代码)

http://www.itjxue.com  2023-02-14 04:48  来源:未知  点击次数: 

求一个留言板代码,直接用HTML、JS完成的!可以保存数据

想要保存信息就必须要操作后台,静态网页时无法

保存数据的,就算一时保存了下来,还是会随着网页

的关闭,数据还是会消失的,明白?

我晕!

那还是一样的性质,只是数据库文件变成了XML文件罢了

求静态HTML留言板程序!

这个是及其简单的聊天

html

head

meta http-equiv="Content-Type" content="text/html; charset=utf-8"

title简单聊天/title

style

* {

font-size:12px;

margin:0;

padding:0;

}

fieldset {

padding:10px;

margin:10px;

width:270px;

color:#333;

border:#06c dashed 1px;

}

legend {

color:#06c;

font-weight:800;

background:#fff;

text-align:center

}

ul {

list-style-type: none;

margin:8px 0 4px 0;

}

li {

margin-top:4px;

}

/style

script type="text/javascript"

function Trim(text)//去左右空格

{

return text.replace(/^\s+|\s+$/g,"");

}

function sendTxt()

{

if (Trim(document.getElementById("txtSendContent").value)=="")

{

alert("输入的内容为空!");

document.getElementById("txtSendContent").focus();

return false;

}

document.getElementById("ulContent").innerHTML+="font color='red'me say/font\r\n:li"+getPic(document.getElementById("txtSendContent").value)+"/li\r\n";

}

function getPic(text)

{

text=text.replace(/:\)/gim,"img src='images/QQ/smile.gif' border='0' width='24' height='24'");

text=text.replace(/:\(/gim,"img src='images/QQ/cry.gif' border='0' width='24' height='24'");

text=text.replace(/:-\(/gim,"img src='images/QQ/cry.gif' border='0' width='24' height='24'");

text=text.replace(/:-\)/gim,"img src='images/QQ/smile.gif' border='0' width='24' height='24'");

text=text.replace(/:)/gim,"img src='images/QQ/smile.gif' border='0' width='24' height='24'");

//var pattern=new RegExp("\

","gim");

text=text.replace(/\

([^\[]*)([^\[]*)\[\/img]/gim,"img src='images/QQ/$2' border='0' width='19' height='19'");

text=text.replace("\r\n","br");

return text;

}

function choosePic()

{

var returnValue=window.showModalDialog('emot.htm',null,'dialogHeight:240px;dialogWidth:300px');

document.getElementById("txtSendContent").value+=returnValue;

}

function test()

{

var ss = "Is is the cost of of gasoline going up up?.\n";

var re = /\b([a-z]+) \1\b/gim; //创建正则表达式样式.

var rv = ss.replace(re,"$1"); //用一个单词替代两个单词.

alert(rv);

}

/script

/head

body style="text-align:center"

fieldset style="width:326px"

legend消息显示区/legend

ul id="ulContent" style="text-align:left"

/ul

/fieldset

br

fieldset

legend消息发送区/legend

form name="form1" method="post" action=""

label

textarea name="txtSendContent" id="txtSendContent" cols="40" rows="10"/textarea

/label

label

input type="button" name="button" id="button" value="发送" onClick="return sendTxt();"

input type="button" name="button" id="button" value="test" onClick="return test();"

/label

img src="images/QQ/smile.gif" alt="选择表情符" title="选择表情符" style="cursor:hand" width="24" height="24" onClick="return choosePic();"

/form

/fieldset

/body

/html

网页留言板的代码

meta http-equiv="Content-Type" content="text/html;charset=gb2312"

%@ Language=VBScript %

!--#INCLUDE FILE="config.asp" --

!--#INCLUDE FILE="guest_lib.asp" --%

dim ASPBook

dim StrSQL

if not isempty(request("page")) then

Mypage=cint(Request("page"))

else

Mypage=1

end if

set ASPBook = Server.CreateObject("ADODB.Recordset")

StrSQL = "Select * from guest order by ID desc"

ASPBook.open StrSQL,conn,1,1

ASPBook.pagesize=Mypagesize

maxpages=cint(ASPBook.pagecount)

totalsize=cint(Mypagesize)

ASPBook.absolutepage=Mypage

GuestTotal=ASPBook.RecordCount

if cint(Mypage) 1 then

if cint(Mypage) maxpages then

MESSAGE("li没有你所想去的页数!/li")

Response.End

end if

end if

HEADER "显示留言"

MyMenu

%

html

head

title[ 客户留言系统 ]/title

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

link rel="stylesheet" href="css/colorbird.css"

style

BODY {SCROLLBAR-FACE-COLOR: #D4D0C8; SCROLLBAR-HIGHLIGHT-COLOR: #999999; SCROLLBAR-SHADOW-COLOR: #999999; SCROLLBAR-3DLIGHT-COLOR: #FFFFFF; SCROLLBAR-ARROW-COLOR: #000000; SCROLLBAR-TRACK-COLOR: #E3E3E3; SCROLLBAR-DARKSHADOW-COLOR: #666666; }

/style

/head

body bgcolor="#FFFFFF" topmargin="0" leftmargin="0"

p align="center"a href="gb_sign.asp"

img border="0" src="IMAGES/sign.gif" alt="签写留言"/a/p

tdp align="center"font color="#000000"bfont face="Arial" size="1"Total of

font color="#ff0000"%=GuestTotal%/font messages, /font/b/font

font face="Arial"font size="1" color="#ff0000"%=MyPageSize%/fontfont size="1"

messages per page, You are on page/font/font/fontfont color="#FF0000"font size="1" face="Arial"%=cint(Mypage)%/font

%=Greeting%... font color="#000000"%PageLink%/font/p

/font

div align="right"/div/td

div align="center"

center

table width="590" border="0" cellspacing="0" cellpadding="0"

tr

td height="50"a href="gb_sign.asp"img src="IMAGES/shop.gif" alt="签写留言" width="89" height="25" border="0"/a/td

/tr

/table

table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#6699CC" width="590" height="197"

tr

td align="center" height="197"

table width="590" border="0" cellspacing="0" cellpadding="4" style="border-collapse: collapse" height="35" bgcolor="#F7F7F7"

tr

/tr

tr

/tr

/table

table cellspacing="1" border="1" width="592" height="23" style="border-collapse: collapse" cellpadding="0" bgcolor="#C6C3C6" bordercolorlight="#FFFFFF" bordercolordark="#000000" background="table.gif"

tr

td align="right" width="130" height="23"

p align="left"b

font color="#FFFFFF"留言者 :/font/b/p

/td

td align="right" width="445" height="23"

p align="left"b

font color="#FFFFFF"留言内容 :/font/b/p

/td

/tr

/table

table width="590" border="0" cellspacing="0" cellpadding="0"

%

If ASPBook.Eof or ASPBook.Bof then

Response.Write "TR"

Response.Write "TD bgcolor=" Color1 " align=center colspan=6FONT STYLE=font-size:9pt对不起,目前还没有任何留言,如要留言,请按“我要留言”图片!/FONT/TD"

else

i = 0

total = 0

do until ASPBook.Eof or total = totalsize

if i = 0 then

CColor = Color1

else

CColor = Color2

end if

%

tr bgcolor="%=CColor%"

td

table width="590" border="1" cellspacing="8" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111"

tr

/tr

/table

table width="590" border="0" cellpadding="2" style="border-collapse: collapse" bordercolor="#111111" height="1"

tr

td width="137" rowspan="3" height="1" valign="top"

table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="99%" id="AutoNumber2" height="96"

tr

td width="100%" align="center" height="12"b%=ASPBook("名字")%/b/td

/tr

tr

td width="100%" align="center" height="54"%if ASPBook("性别") = "boy" then%

br

img src="images/boy.gif" alt="英俊潇洒的 %=ASPBook("名字")% 先生" align="middle" border="0"

%elseif ASPBook("性别") = "girl" then%

img src="images/girl.gif" alt="美丽又温柔的 %=ASPBook("名字")% 小姐" align="middle" border="0"

br

%end if%/td

/tr

tr

td width="100%" align="center" height="28"Form: %=ASPBook("来自")% /td

/tr

/table

/td

td width="234" height="1"font size="1"

font color="#000000" class="littel"

img src="./icons/em%=ASPBook("表情")%.gif" border="0" align="ABSCENTER"/fontfont color="#0000FF" class="littel"On:

%=ASPBook("留言日期")%/font/fontfont size="1" color="#0000FF"

/font/td

td width="212" height="1"%if ASPBook("邮件")"" then%

a href="mailto:%=ASPBook("邮件")%"

img src="images/email.gif" ALIGN="absmiddle" border="0" width="15" height="16"/a

%end if% %if ASPBook("主页")"" and ASPBook("主页")"http://" then%

a href="%=ASPBook("主页")%" Target="_blank"

img src="images/home.gif" ALIGN="absmiddle" border="0"/a

%end if% %if ASPBook("ICQ")"" then%

img src="images/icq.gif" alt="ICQ:%=ASPBook("ICQ")%" align="absmiddle" border="0" width="15" height="16"

%if ASPBook("OICQ")"" then% %end if%

a href=";%=ASPBook("OICQ")%" target="_blank"

img src="images/oicq.gif" alt="OICQ:%=ASPBook("OICQ")%" align="absmiddle" border="0" width="16" height="16"/a

%end if%

img src="images/ip.gif" alt="%=ASPBook("IP")%" align="absmiddle" border="0" width="13" height="16"

img src="images/system.gif" alt="%=ASPBook("系统")%" align="absmiddle" border="0" width="15" height="16"/td

/tr

tr

td width="450" height="14" colspan="2" valign="top"%=ASPBook("留言")% /td

/tr

tr

%if ASPBook("Reply")"" then%td width="450" height="17" colspan="2" valign="top"

font color="#FF0000"Reply :b /b/font

font color="#0000FF" class="littel" size="1"(%=ASPBook("Reply_Date")%)/fontbr

img src="./icons/em%=ASPBook("Reply_Icon")%.gif" border="0" align="ABSCENTER"%=ASPBook("Reply")%/font/td

%end if%/tr

/table

table width="590" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111"

tr

td width="137" rowspan="2" /td

td width="450"/td

/tr

tr

td width="450" /td

/tr

/table

table width="590" height="24" border="0" cellpadding="0" cellspacing="1" bordercolor="#DCE8F3" bordercolorlight="#FFFFFF" bgcolor="#DCE8F3" style="border-collapse: collapse"

tr

td align="right" width="131" height="20"

p align="left" /p

/td

td align="right" width="448" height="20"

a href="gb_reply.asp?page=%=mypage%Number=%=ASPBook("ID")%"

img src="images/quote.gif" alt="回复该留言" align="absmiddle" border="0" width="16" height="16"/a

a href="gb_delete.asp?page=%=mypage%Number=%=ASPBook("ID")%"

img src="images/recycle.gif" alt="删除该留言" align="absmiddle" border="0" width="16" height="16"/a/td

/tr

/table

/td

/tr

%

ASPBook.MoveNext

i = i + 1

if i = 2 then i = 0

total = total + 1

loop

% %END IF%

/table

%COPYRIGHT%

table border="0" cellpadding="2" cellspacing="0" width="590" height="1" bgcolor="#F7F7F7" style="border-collapse: collapse" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF"

tr

td width="131" height="1"

p align="center"/p

/td

td align="right" width="448" height="1"font color="#000000"%PageLink%

/font /td

/tr

/table

/td

/tr

/table

/center

/div

div align="center"

center

table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="592" id="AutoNumber1"

tr

td width="100%"

p align="center"a href="gb_sign.asp" /abr

/p

/td

/tr

/table

/center

/div

/body

/html

%

function PageLink

PageShowSize = 10

Scriptname=Request.Servervariables("script_name")

PageNextSize=int((MyPage-1)/PageShowSize)+1

Pagetpage=int((GuestTotal-1)/MyPageSize)+1

if Maxpages 1 then

if PageNextSize 1 then

PagePrev=PageShowSize*(PageNextSize-1)

Response.write "a href='" Scriptname "?page=" PagePrev "'[]/a-"

end if

if Mypage-1 0 then

Prev_Page = MyPage - 1

Response.write "a href='" Scriptname "?page=" Prev_Page "'[]/a "

end if

if maxpages=PageNextSize*PageShowSize then

PageSizeShow = PageShowSize

else

PageSizeShow = Maxpages-PageShowSize*(PageNextSize-1)

end if

for PageCounterSize=1 to PageSizeShow

PageLink = (PageCounterSize+PageNextSize*10)-10

if PageLink cint(Mypage) then

Response.write "a href='" Scriptname "?page=" PageLink "'[" PageLink "]/a "

else

Response.Write PageLink " "

end if

next

if Mypage+1 =Pagetpage then

Next_Page = MyPage + 1

Response.write "a href='" Scriptname "?page=" Next_Page "'[]/a"

end if

if maxpages PageShowSize*PageNextSize then

PageNext = PageShowSize * PageNextSize + 1

Response.write "-a href='" Scriptname "?page=" PageNext "'[]/a"

end if

else

Response.write "[1]"

end if

END function

set ASPBook=nothing

conn.Close

set conn = nothing

%

给我发一下用HTML 做的 留言板网页的 代码 好吗?谢谢!!!

没有html做的留言板,都是cgi、asp、php、jsp、.net之类的程序语言结合html才能做

留言板代码网上百度一大堆:php留言板、asp留言板什么的,自己百度自己下载。

完整的php&mysql的留言板源代码,可以运行的

input.htm

html

head

meta http-equiv="Content-Language" content="zh-cn"

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

titleinput/title

/head

body

form method="POST" action="receive.php"

p您的姓名: input type="text" name="T1" size="20"/p

p您的性别:男input type="radio" value="0" name="R1"

女input type="radio" name="R1" value="1"/p

p您的EMAIL:input type="text" name="T2" size="35"/p

p您的留言内容:/p

p textarea rows="16" name="S1" cols="45"/textarea/p

p /p

p input type="submit" value="提交" name="B1"

input type="reset" value="重置" name="B2"/p

/form

/body

/html

receive.php

?php

$user='root';

$password='123';

$db='guestbook';

$table='gbook';

$ip=getenv(REMOTE_ADDR);

$sql = "INSERT INTO `guestbook`.`gbook` (`id`, `name`, `sex`, `email`, `info`, `ip`, `time_at`) VALUES (NULL, '$T1', '$R1', '$T2', '$S1', '$ip', NOW());";

$connect=mysql_connect('localhost',$user,$password);

mysql_select_db($db);

mysql_query($sql);

$result=mysql_query("select * from $table");

while ($arr=mysql_fetch_array($result))

{

if ($arr[2]==0)

$gender='先生';

else

$gender='女士';

?

html

head

meta http-equiv="Content-Language" content="zh-cn"

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

titleReceive/title

/head

body style="background-attachment: fixed"

table border="1" width="100%" id="table1" bgcolor="#FFFFFF"

tr

td bordercolor="#FFFFFF" bgcolor="#C0C0C0"?=$arr[6]?(?=$arr[5]?)p?=$arr[1]? ?=$gender?a href="?=$arr[3]?"?=$arr[3]?/a

写到:/td

/tr

tr

td?=$arr[4]?p /p

pa href="del.php?id=?=$arr[0]?"[删除]/a

a href="modify.php?id=?=$arr[0]?"[修改]/a]/td

/tr

/table

/body

/html

?php

echo 'p';

echo 'p';

}

?

html

head

meta http-equiv="Content-Language" content="zh-cn"

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

title新建网页 1/title

/head

body

pa href="input.htm"继续留言/a/p

/body

/html

del.php

?php

$user='root';

$password='123';

$db='guestbook';

$table='gbook';

$sql="DELETE FROM $table WHERE id=$id";

$connect=mysql_connect('localhost',$user,$password);

mysql_select_db($db);

$result=mysql_query($sql);

if ($result)

echo "删除成功";

else

echo "删除失败";

?

html

head

meta http-equiv="Content-Language" content="zh-cn"

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

title新建网页 1/title

/head

body

pa href="receive.php"返回首页/a/p

/body

/html

modify.php

?php

$user='root';

$password='123';

$db='guestbook';

$table='gbook';

$ip=getenv(REMOTE_ADDR);

$connect=mysql_connect('localhost',$user,$password);

mysql_select_db($db);

$result=mysql_query("select * from $table where id=$id");

$arr=mysql_fetch_array($result);

?

html

head

meta http-equiv="Content-Language" content="zh-cn"

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

titleinput/title

/head

body

form method="POST" action="modify_ok.php?id=?=$id?"

p您的姓名: input type="text" name="T1" size="20" value="?=$arr[1]?"/p

p您的性别:

?php

if ($arr[2]==0) echo '男input type="radio" value="0" name="R1" checked

女input type="radio" name="R1" value="1"/p';

else echo '男input type="radio" value="0" name="R1"

女input type="radio" name="R1" value="1" checked/p';

?

p您的EMAIL:input type="text" name="T2" size="35" value="?=$arr[3]?"/p

p您的留言内容:/p

p textarea rows="16" name="S1" cols="45" ?=$arr[4]?/textarea/p

p /p

p input type="submit" value="修改" name="B1"

input type="reset" value="重置" name="B2"/p

/form

/body

/html

modify_ok.php

?php

$user='root';

$password='123';

$db='guestbook';

$table='gbook';

$connect=mysql_connect('localhost',$user,$password);

mysql_select_db($db);;

$sql = "UPDATE `guestbook`.`gbook` SET `name` = '$T1', `sex` = '$R1', `email` = '$T2', `info` = '$S1' WHERE `gbook`.`id` = '$id' LIMIT 1;";

$result=mysql_query($sql);

if ($result)

echo "修改成功";

else

echo "修改失败";

?

html

head

meta http-equiv="Content-Language" content="zh-cn"

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

title新建网页 1/title

/head

body

pa href="input.htm"继续留言/a/p

/body

/html

求助 请完成如下HTML代码

应该是这样的吧。。

form?action="post.asp"?method="post"

????table

????????tr

????????????td标题/td

????????????tdinput?type="text"?name="title"?style="width:20px;"/td

????????/tr

????????tr

????????????td作者/td

????????????tdinput?type="text"?name="author"?style="width:10px;"/td

????????/tr

????????tr

????????????td留言内容/td

????????????td

????????????????textarea?name="content"?cols="40"?rows="5"/textarea

????????????/td

????????/tr

????????tr

????????????td/td

????????????td

????????????????input?type="submit"?value="提交"?/

????????????????input?type="reset"?value="清空"?/

????????????/td

????????/tr

????/table

/form

(责任编辑:IT教学网)

更多

推荐JSP教程文章