ASP編程中樹型結構的提交

來源:互聯網
上載者:User

示範: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>

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.