The project needs to place a portion of the user's information everywhere at the client's designated location, requiring a specific disk root directory and taking some time to make an interface.
The Getdiskinfo () function is used to obtain the letter information and is added to the HTML control select.
The Exportkey () function is used to determine the location selected by the user and to write the information to the Userkey.txt file under that location.
< HTML >
< head >
< title > Export </title >
< SCRIPT language = "JavaScript" >
function Getdiskinfo ()
... {
var fso = new ActiveXObject ("Scripting.FileSystemObject");
var drives = fso. drives;
var e = new Enumerator (drives);
var selectinfo = document.getElementById ("SelectList");
for (;!e.atend (); E.movenext ())
... {
var anoption = document.createelement ("option");
Anoption.text = E.item (). Path;
Selectinfo.add (anoption);
}
}
function Exportkey ()
... {
var key = window.document.form1.<%= this. Userinfotextbox.clientid%>.value;
var fso = new ActiveXObject ("Scripting.FileSystemObject");
var e = new Enumerator (FSO. drives);
var path = Window.document.form1.selectlist.options[window.document.form1.selectlist.selectedindex].text + "/ Userkey.txt ";
for (var i = 0; i < (window.document.form1.selectlist.selectedindex-1); i++)
... {
E.movenext ();
}
if (E.item (). IsReady)
... {
F1 = fso. CreateTextFile (path, true);
F1. Write (key);
F1. Close ();
Alert ("Complete the export.") ");
}
Else
... {
Alert ("There is a problem with the storage location you have selected, please re-enter it.") ");
}
}
</script >
< body onload = "getdiskinfo ();" ms_positioning = "GridLayout" >
< form ID = "Form1" method = "post" runat = "server" >
< FONT face = "Song Body" >
< SELECT ID = "SelectList" style = "z-index:101;" left:8px; width:112px; Position:absolute; Top:8px ">
< option ></option >
</SELECT >
< INPUT onclick = "Exportkey ();" style = "z-index:102; left:128px; Position:absolute; top:8px "type =" button "value =" Export ">
< Asp:textbox ID = "Userkeytextbox" style = "z-index:103"; left:136px; Position:absolute; Top:64px "
runat = "Server" height