关于HTML表格问题

关于HTML表格问题,第1张

<!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/htmlcharset=gb2312" />

<title>无标题文档</title>

<style type="text/css">

<!--

.Tab {

width:200px

height:300

}

body {

margin-left: 0px

margin-top: 0px

margin-right: 0px

margin-bottom: 0px

}

body,td,th {

font-size: 12px

color: #333333

}

.STYLE1 {color: #009933}

.STYLE2 {

color: #006633

font-weight: bold

}

.STYLE3 {color: #006633}

-->

</style></head>

<body>

<table width="900" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>

<td height="30" bgcolor="#B9E3BA"> </td>

</tr>

<tr>

<td height="30"> </td>

</tr>

<tr>

<td height="20"> </td>

</tr>

</table>

<table width="900" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>

<td width="200" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td bgcolor="#74C78E"><table width="100%" border="0" cellspacing="2" cellpadding="0">

<tr>

<td valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td height="25" bgcolor="#B9E3BA"> </td>

</tr>

<tr>

<td height="2"></td>

</tr>

<tr>

<td height="2" bgcolor="#D3E1D2"></td>

</tr>

<tr>

<td><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="12%" height="25"> </td>

<td width="88%"><strong>控制面板首页</strong></td>

</tr>

</table></td>

</tr>

<tr>

<td height="2" bgcolor="#D3E1D2"></td>

</tr>

<tr>

<td height="25"><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="12%" height="25"> </td>

<td width="88%"><span class="STYLE1">编辑个人资料</span></td>

</tr>

</table></td>

</tr>

<tr>

<td height="2" bgcolor="#D3E1D2"></td>

</tr>

<tr>

<td><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="12%" height="25"> </td>

<td width="88%"><span class="STYLE1">积分记录</span></td>

</tr>

</table></td>

</tr>

<tr>

<td height="2" bgcolor="#D3E1D2"></td>

</tr>

<tr>

<td height="80" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="18%" height="20"> </td>

<td width="82%"><span class="STYLE1">转账与兑换记录</span></td>

</tr>

<tr>

<td height="20"> </td>

<td class="STYLE1">主题付费记录</td>

</tr>

<tr>

<td height="20"> </td>

<td class="STYLE1">主题收益记录</td>

</tr>

<tr>

<td height="20"> </td>

<td class="STYLE1">悬赏付费记录</td>

</tr>

</table></td>

</tr>

<tr>

<td height="2" bgcolor="#D3E1D2"></td>

</tr>

<tr>

<td height="25"><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="12%" height="25"> </td>

<td width="88%"><span class="STYLE1">好友列表</span></td>

</tr>

</table></td>

</tr>

<tr>

<td height="2" bgcolor="#D3E1D2"></td>

</tr>

<tr>

<td height="25"><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="12%" height="25"> </td>

<td width="88%"><span class="STYLE1">个人空间</span></td>

</tr>

</table></td>

</tr>

<tr>

<td height="2" bgcolor="#D3E1D2"></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

</table></td>

<td width="15"> </td>

<td width="685" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td height="25" bgcolor="#99CC66"><table width="100%" border="0" cellspacing="2" cellpadding="0">

<tr>

<td height="25" bgcolor="#FFFFFF"> </td>

</tr>

</table></td>

</tr>

</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td> </td>

</tr>

</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="72%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td bgcolor="#74C78E"><table width="100%" border="0" cellspacing="2" cellpadding="0">

<tr>

<td valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td height="25" bgcolor="#B9E3BA"> <span class="STYLE2">最近的2条短消息</span></td>

</tr>

<tr>

<td height="2"></td>

</tr>

<tr>

<td height="2" bgcolor="#D3E1D2"></td>

</tr>

<tr>

<td><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="52%" height="25"> 标题</td>

<td width="17%" align="center">来自</td>

<td width="31%" align="center">时间</td>

</tr>

</table></td>

</tr>

<tr>

<td height="2" bgcolor="#D3E1D2"></td>

</tr>

<tr>

<td height="25"><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="52%" height="25"> <span class="STYLE1">本次内联战报报道员有奖励么?数额多少?</span></td>

<td width="17%" align="center"><strong>飞扬</strong></td>

<td width="31%" align="center">2008-07-10 15:30 </td>

</tr>

</table></td>

</tr>

<tr>

<td height="2" bgcolor="#D3E1D2"></td>

</tr>

<tr>

<td><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="52%" height="25"> <span class="STYLE1">本次内联战报报道员有奖励么?数额多少?</span></td>

<td width="17%" align="center"><strong>飞扬</strong></td>

<td width="31%" align="center">2008-07-10 15:30 </td>

</tr>

</table></td>

</tr>

<tr>

<td height="2" bgcolor="#D3E1D2"></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td> </td>

</tr>

</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td bgcolor="#74C78E"><table width="100%" border="0" cellspacing="2" cellpadding="0">

<tr>

<td valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td height="25" bgcolor="#B9E3BA"><span class="STYLE2"> 最近的2条转帐与兑换记录</span></td>

</tr>

<tr>

<td height="2"></td>

</tr>

<tr>

<td height="2" bgcolor="#D3E1D2"></td>

</tr>

<tr>

<td><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="30%" height="25"> 来自/到</td>

<td width="21%" align="center">时间</td>

<td width="19%" align="center">支出</td>

<td width="16%" align="center">收入</td>

<td width="14%" align="center"> *** 作</td>

</tr>

</table></td>

</tr>

<tr>

<td height="2" bgcolor="#D3E1D2"></td>

</tr>

<tr>

<td><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="30%" height="25"> 目前没有积分交易记录。</td>

<td width="21%" align="center"> </td>

<td width="19%" align="center"> </td>

<td width="16%" align="center"> </td>

<td width="14%" align="center"> </td>

</tr>

</table></td>

</tr>

<tr>

<td height="2" bgcolor="#D3E1D2"></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

</table></td>

<td width="28%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="5"></td>

<td bgcolor="#74C78E"><table width="100%" border="0" cellspacing="1" cellpadding="0">

<tr>

<td height="200" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td colspan="3" height="5"></td>

</tr>

<tr>

<td width="8%"> </td>

<td width="83%" align="center" valign="middle"><table width="118" border="0" cellspacing="0" cellpadding="0">

<tr>

<td bgcolor="#99CC66"><table width="118" border="0" cellspacing="1" cellpadding="0">

<tr>

<td height="100" align="center" bgcolor="#FFFFFF"><img src="" alt="" name="img" width="112" height="98" id="img" /></td>

</tr>

</table></td>

</tr>

</table></td>

<td width="9%"> </td>

</tr>

<tr>

<td colspan="3" height="5"></td>

</tr>

<tr>

<td height="20"> </td>

<td align="center"><strong>c.d.k</strong></td>

<td> </td>

</tr>

<tr>

<td height="20"> </td>

<td align="center">积分:<strong>579</strong></td>

<td> </td>

</tr>

<tr>

<td height="20"> </td>

<td align="center">威望:<strong>579</strong></td>

<td> </td>

</tr>

<tr>

<td height="20"> </td>

<td align="center">金钱:<strong>0 足球币</strong></td>

<td> </td>

</tr>

<tr>

<td height="20"> </td>

<td align="center">用户组:<strong>普通会员</strong></td>

<td> </td>

</tr>

<tr>

<td height="20" colspan="3" bgcolor="#B9E3BA"> <span class="STYLE2">好友列表    </span><span class="STYLE3">>> 编辑好友列表</span></td>

</tr>

<tr>

<td height="20"> </td>

<td>在线</td>

<td> </td>

</tr>

<tr>

<td height="2" colspan="3" bgcolor="#D3E1D2"></td>

</tr>

<tr>

<td height="20"> </td>

<td>离线</td>

<td> </td>

</tr>

<tr>

<td height="2" colspan="3" bgcolor="#D3E1D2"></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

</table>

</body>

</html>

1、ASP文件中的代码

pencat=rs.Fields.Item("m_content").Value

pencat=replace(pencat,"t_title",n_title)

pencat=replace(pencat,"t_author",n_author)

pencat=replace(pencat,"t_content",n_content)

Set fso = Server.CreateObject("Scripting.FileSystemObject")

Set fout = fso.CreateTextFile(server.mappath(fpath&"\" &fname))

fout.WriteLine pencat

fout.close

2、如下给出要生成的网页模板:

<html>

<head>

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

<meta http-equiv=""Content-Type"" content=""text/htmlcharset=gb2312"">

<meta name=""GENERATOR"" content=""Microsoft FrontPage 4.0"">

<meta name=""ProgId"" content=""FrontPage.Editor.Document"">

<title></title>

</head>

<body topmargin=""0"" leftmargin=""0"">

<table border=""0"" width=""760"" height=""100%"" background=""background.jpg"" >

<tr>

<td width=""752"" height=""10"" colspan=""3"">

<p align=""center"">t_title

</td>

</tr>

<tr>

<td width=""752"" height=""18"" colspan=""3"">

<div align=""center"">

</div>

<div align=""center"">

<font size=""2"">

作者:</font><font color=""#990000"">t_author</font>

<font size=""2"">

加入时间:</font><font color=""#990000"">t_date</font>

</div>

</td>

</tr>

<tr>

<td width=""15%"" height=""100%"" valign=""top"">

</td>

<td width=""70%"" height=""100%"" valign=""top"">

t_content

</td>

<td width=""15%"" height=""100%"" valign=""top"">

</td>

</tr>

</table>

</body>

</html>

3、解释

(1)pencat=rs.Fields.Item("m_content").Value

pencat为一个字符串变量。

rs.Fields.Item("m_content").Value就是如上2、网页模板的全部HTML字符

(2)pencat=replace(pencat,"t_title",n_title)

pencat=replace(pencat,"t_author",n_author)

pencat=replace(pencat,"t_content",n_content)

以上三句就是将字符串中的字串替换成为你所需要的内容,即ASP中动态获得的内容。

(3)Set fso = Server.CreateObject("Scripting.FileSystemObject")

Set fout = fso.CreateTextFile(server.mappath(fpath&"\" &fname))

fout.WriteLine pencat

fout.close

以上为将刚刚组合所得的网页代码写入文件的过程。第一句定义fso文件,第二句创建输出流文件,其中fpath为你想要存储的文件的路径,fname为文件名;后两句是将字符串写入文件和关闭输出流文件。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/7235089.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-03
下一篇 2023-04-03

发表评论

登录后才能评论

评论列表(0条)

保存