标题:
软景目录多列显示方法
[打印本页]
作者:
无极
时间:
2012-6-12 01:43
标题:
软景目录多列显示方法
出差在外,发个帖也方便。过几天又有事!
软景生成的目录默认是一列,不好改成多列的!想了一种改成多列显示的方法。原理还是利用类此HP那样生成一个数组来实现。具体过程如下。
用软景自带的模板做个例子
一、生成pages数组
这是软景生成后,默认的效果图
[attach]58065[/attach]
其默认的整个网页代码如下
<!--//Built by Softscape HTML Builder 3.0 http://www.ruanjing.com-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>目录</title>
<style>
<!--
.title_index{ /*大标题样式*/
font-size: 26pt;
font-family: "隶书";
color: #669900;
font-weight: bold;
}
.title_page{ /*题目样式*/
font-size: 12pt;
font-family: "黑体";
color: #669900;
font-weight: bold;
}
.content{/*内容样式*/
font-size: 12pt;
font-family: "宋体";
line-height: 16pt; /*行距*/
}
.content img {
margin: 7px;
}
.9{ font-size: 9pt }
.TitleLinks{ /*索引列表的停靠方位*/
text-align: center;
}
.TitleLinks .content { /*索引页使用文字列表符时,修改行距*/
line-height: 20pt;
}
.TitleLinks .content img { /*索引页使用图形列表符时,修改行距*/
margin-top: 7px;
margin-bottom: 7px;
}
A:link {text-decoration: none; color:#0033CC}
A:visited {text-decoration: none; color: #0033CC}
A:active {text-decoration: none; color: #0000ff }
A:hover {text-decoration: underline; color: #FF0000 }
.b1 {
background-image: url(images/NA00760_.GIF);
background-repeat: no-repeat;
}
.b2 {
background-image: url(images/NA00760_2.GIF);
background-repeat: no-repeat;
background-position: right bottom;
}
-->
</style>
</head>
<body bgcolor="#FFFFFF" background="images/GRNSAND.JPG">
<div align="center">
<center>
<table border="0" cellpadding="1" cellspacing="0" width="90%">
<tr>
<td width="90%" bgcolor="#000000"><table width="100%" height="293" border="0"
cellpadding="0" cellspacing="0" bgcolor="#FEEDFE">
<tr>
<td width="100%" class="b1"><DIV class="content">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="246" valign="top" class="b2"><table width="100%" height="358" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="9%" height="29"> </td>
<td width="82%" valign="bottom"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="9">
<tr>
<td width="65%" align="right"> </td>
<td width="35%"><div align="right"> </div></td>
</tr>
</table></td>
<td width="9%"> </td>
</tr>
<tr>
<td height="284"> </td>
<td valign="top" class="content"><div align="center" class="title_index"><br>
目录</div>
<p><div class="TitleLinks"><table border="0" cellpadding="0" cellspacing="0"><tr><td><div class="content"><img src="icon.gif" align="absmiddle"> <A HREF="mydoc000.htm" >第〇〇一节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc001.htm" >第〇〇二节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc002.htm" >第〇〇三节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc003.htm" >第〇〇四节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc004.htm" >第〇〇五节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc005.htm" >第〇〇六节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc006.htm" >第〇〇七节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc007.htm" >第〇〇八节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc008.htm" >第〇〇九节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc009.htm" >第〇一〇节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc010.htm" >第〇一一节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc011.htm" >第〇一二节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc012.htm" >第〇一三节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc013.htm" >第〇一四节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc014.htm" >第〇一五节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc015.htm" >第〇一六节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc016.htm" >第〇一七节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc017.htm" >第〇一八节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc018.htm" >第〇一九节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc019.htm" >第〇二〇节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc020.htm" >第〇二一节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc021.htm" >第〇二二节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc022.htm" >第〇二三节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc023.htm" >第〇二四节</A><BR>
<img src="icon.gif" align="absmiddle"> <A HREF="mydoc024.htm" >第〇二五节</A><BR>
<!--HTMLBuilderInsertPoint--></div></td><td width="20"> </td></tr></table></div> <br>
<br>
</p></td>
<td> </td>
</tr>
<tr>
<td height="45"> </td>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="9">
<tr>
<td align="right"> </td>
<td width="150"> </td>
</tr>
</table>
<span class="9"><font color="#CCCCCC">创建时间:2012-6-12 </font></span></td>
<td> </td>
</tr>
</table></td>
</tr>
</table>
</div></td>
</tr>
</table></td>
</tr>
</table>
<a href="http://www.ruanjing.com?a=hb2" target="_blank"><font color="#999999" face="Arial, Helvetica, sans-serif" style="font-size:8pt;">Power
by Softscape HTML Builder 3</font></a>
</center>
</div>
</body>
</html>
复制代码
执行下面的EE脚本生成pages数组,并插入到网页头处
注意:如果没有插入到网页中,请自己粘贴到合适的位置
这是生成数组的EE脚本
var str="<script language=\"javascript\">"+"\n";
str+="var pages=new Array();"+"\n";
var reg=new RegExp("<a href=(.*\.htm)[^#].*>(.*)<\/a>","gmi")
document.selection.StartOfDocument();
document.selection.SelectAll();
var txt = document.selection.Text;
var aReturn;
var i=0;
while(1){
aReturn= reg.exec(txt);
if(aReturn!=null)
{
//去掉字符串本身自带的"
aReturn[1]=aReturn[1].replace(/\"/gi,"");
aReturn[2]=aReturn[2].replace(/\"/gi,"");
str+="pages["+i+"]=[\""+aReturn[1] +"\",\""+aReturn[2]+"\"];"+"\n";
i++;
}
else
{
break;
}
}
str+="<\/script>";
var found=document.selection.Replace("<\/head>",str+"\n"+"<\/head>",eeReplaceAll);//在网页头部插入pages数组
if(found==0)//没有找到网页头结束标签,提醒用户自行粘贴
{
clipboardData.setData( "Text", str);
alert("pages数组已经复制到剪贴板,请自行粘贴到文档的合适位置");
}
复制代码
生成的数组如下
<script language="javascript">
var pages=new Array();
pages[0]=["mydoc000.htm","第〇〇一节"];
pages[1]=["mydoc001.htm","第〇〇二节"];
pages[2]=["mydoc002.htm","第〇〇三节"];
pages[3]=["mydoc003.htm","第〇〇四节"];
pages[4]=["mydoc004.htm","第〇〇五节"];
pages[5]=["mydoc005.htm","第〇〇六节"];
pages[6]=["mydoc006.htm","第〇〇七节"];
pages[7]=["mydoc007.htm","第〇〇八节"];
pages[8]=["mydoc008.htm","第〇〇九节"];
pages[9]=["mydoc009.htm","第〇一〇节"];
pages[10]=["mydoc010.htm","第〇一一节"];
pages[11]=["mydoc011.htm","第〇一二节"];
pages[12]=["mydoc012.htm","第〇一三节"];
pages[13]=["mydoc013.htm","第〇一四节"];
pages[14]=["mydoc014.htm","第〇一五节"];
pages[15]=["mydoc015.htm","第〇一六节"];
pages[16]=["mydoc016.htm","第〇一七节"];
pages[17]=["mydoc017.htm","第〇一八节"];
pages[18]=["mydoc018.htm","第〇一九节"];
pages[19]=["mydoc019.htm","第〇二〇节"];
pages[20]=["mydoc020.htm","第〇二一节"];
pages[21]=["mydoc021.htm","第〇二二节"];
pages[22]=["mydoc022.htm","第〇二三节"];
pages[23]=["mydoc023.htm","第〇二四节"];
pages[24]=["mydoc024.htm","第〇二五节"];
</script>
复制代码
作者:
无极
时间:
2012-6-12 02:09
此时目录如下
[attach]58066[/attach]
附件是用师士传说做得例子,和相关关的脚本
表格样式比较难看,这个自己去修改吧。看球去了
作者:
健少
时间:
2012-6-12 13:39
好贴!进来瞅瞅~
作者:
梦千寻
时间:
2012-6-12 19:53
又见高手出动啦!
作者:
无极
时间:
2013-6-24 21:45
最近看软景书,用这个整理下
欢迎光临 (http://ftp.zasq.net/~zazww/)
Powered by Discuz! X3.2