ASP编程中树型结构的提交

 演示:http://asp2004.net/temp/treemenu/favorite.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--#include file="conn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网络书签</title>
</head>

<body>
<%
action=request.QueryString("action")
if action="save" then
dim a(10)
a(0)=0
tt=request.Form("tt")
t=split(tt,chr(13))
for i=0 to ubound(t)-1
s=split(t(i),chr(9))
conn.execute("insert into menu (id1,menuname,url) values ("&a(s(0)-1)&",'"&s(1)&"','"&s(2)&"')")
if s(2)="" then
 set rs=conn.execute("select top 1 id as tp from menu order by id desc")
 a(s(0))=rs("tp")
end if
next
response.Redirect("index.asp")
else
%>
先把internet安全区域调至底。<br>
先按“载入”按钮 ,可能会提示:“在此页上的ActiveX控件和本页上的其他部分交互可能不安全。您想允许这种交互吗? ”
选择是,收藏夹内容即可载入。再按提交按钮即可保存收藏夹。
<script language="javascript">
var s;
s="";
function ShowFolderFileList(i,folderspec)
{
   var fso,f,fc,name;
   var url,str,file,filename;
   var i;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   f = fso.GetFolder(folderspec);
 s += i++ + "/t" + f.Name + "/t/n";
   fc = new Enumerator( f.files );
   for (; !fc.atEnd(); fc.moveNext( ) )
   {
  filename = fso.GetFileName( fc.item( ) );
  if (filename.indexOf(".url")>=0)
  {
   filename = filename.substring( 0 , filename.length-4 );
   file = fso.GetFile( fc.item( ) );
   ts = file.OpenAsTextStream( 1 , 0 );
   str=ts.ReadLine();
   while( str.indexOf( "URL=" ) < 0 && !ts.AtEndOfStream )
   {
    str = ts.ReadLine( );
   }
   ts.Close( );
   s += i + "/t" + filename + "/t" + str.substr( str.indexOf( "URL=") + 4 ) + "/n";
  }
   }
   fc = new Enumerator(f.SubFolders);
   for (; !fc.atEnd(); fc.moveNext())
   {
  ShowFolderFileList(i,fc.item());
   }
   return( s );
}
function exe()
{
 document.form1.tt.value=ShowFolderFileList(1,document.form1.t.value)
}
</script>
<form name="form1" method="post" action="favorite.asp?action=save">
  <input name="t" type="text" id="t" value="C://Documents and Settings//Administrator//Favorites" size="70">
  <textarea name="tt" cols="120" rows="30" wrap="VIRTUAL"></textarea>
  <br>
  <input type="button" name="Submit" value="载入" onClick="exe();">
  <input type="submit" name="Submit" value="提交">
</form>
<%
end if
%>
</body>
</html>

阅读更多
个人分类: ASP 编程相关资料
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭