Demo: 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> Web bookmarks </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.exe cute ("insert into menu (id1, menuname, URL) values (" & A (S (0)-1) & ", '" & S (1) & "','" & S (2 )&"')")
If S (2) = "" then
Set rs1_conn.exe cute ("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
%>
First, adjust the internet security area to the bottom. <Br>
First, press the "LOAD" button and you may be prompted: "The Interaction Between ActiveX controls on this page and other parts of this page may be insecure. Do you want to allow this interaction? "
Select Yes to load the favorites content. Click the submit button to save the favorites folder.
<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 = "LOAD" onclick = "EXE ();">
<Input type = "Submit" name = "Submit" value = "Submit">
</Form>
<%
End if
%>
</Body>
</Html>