Common.js_javascript techniques used in filemanage functions

Source: Internet
Author: User
Tags tag name
function F_framestyleresize (targobj)
{
var targwin = Targobj.parent.document.all[targobj.name];
if (Targwin!= null)
{
var heightvalue = TargObj.document.body.scrollHeight
if (Heightvalue <) {Heightvalue = 300}//no less than 600
TargWin.style.pixelHeight = Heightvalue;
}
}
function F_iframeresize ()
{
Bloadcomplete = true;
F_framestyleresize (self);
}


var xmlHttp = false;
try {
XmlHttp = new ActiveXObject ("Msxml2.xmlhttp");
catch (e) {
try {
XmlHttp = new ActiveXObject ("Microsoft.XMLHTTP");
} catch (E2) {
XmlHttp = false;
}
}
if (!xmlhttp && typeof xmlhttprequest!= ' undefined ') {
XmlHttp = new XMLHttpRequest ();
}


function Showfiles () {
var url = "Showfile.asp?pid" +math.random ();
Xmlhttp.open ("Get", url, True);
Xmlhttp.onreadystatechange = RELOADX;
Xmlhttp.send (NULL);
}

function Showfiles2 (folder) {
var url = "Showfile.asp?foldername=" +folder+ "&pid" +math.random ();
Xmlhttp.open ("Get", url, True);
Xmlhttp.onreadystatechange = RELOADX;
Xmlhttp.send (NULL);
}

function GoBack () {
var url = "Showfile.asp?go=back" + "&pid" +math.random ();
Xmlhttp.open ("Get", url, True);
Xmlhttp.onreadystatechange = RELOADX;
Xmlhttp.send (NULL);
}

function Gonow () {
document.getElementById ("Filemanage_all"). style.display= "Block";
var url = "Showfile.asp?go=now" + "&pid" +math.random ();
Xmlhttp.open ("Get", url, True);
Xmlhttp.onreadystatechange = RELOADX;
Xmlhttp.send (NULL);
}

function Reloadx () {
if (Xmlhttp.readystate < 4) {
Setmsg (' data loading, please wait ... ');
}
if (xmlhttp.readystate = = 4) {
F_iframeresize ();
var response = Xmlhttp.responsetext;
document.getElementById ("MyFile"). InnerHTML = response;
var bloadcomplete = false;
F_iframeresize ();
}
}

function Delfile ()
{
if (window.confirm) (Are you sure you want to delete the selected file?) ") ==true)
{
var fileid= "";
var obj=document.getelementsbyname (' Myselect ');
for (Var i=0 i < obj.length; i++) {
if (obj[i].checked)
Fileid=fileid+obj[i].value+ ', ';
}
if (Fileid)
{
var url = ".. /delfile.asp?fid= "+fileid+" &pid "+math.random" ();
Xmlhttp.open ("Get", url, True);
Xmlhttp.onreadystatechange = Delfileok;
Xmlhttp.send (NULL);
}
Else
{
Alert ("Please select File First!");
}
}
}

function Share ()
{
var fileid= "";
var obj=document.getelementsbyname (' Myselect ');
for (Var i=0 i < obj.length; i++) {
if (obj[i].checked)
Fileid=fileid+obj[i].value+ ', ';
}
if (Fileid)
{
var url = ".. /shareit.asp?action=share&myselect= "+fileid+" &pid "+math.random" ();
Xmlhttp.open ("Get", url, True);
Xmlhttp.onreadystatechange = Shareok;
Xmlhttp.send (NULL);
}
Else
{
Alert ("Please select File First!");
}

}

function Delfolder (FID)
{
if (window.confirm) (Are you sure you want to delete the selected folder?) ") ==true)
{
var url = ".. /delfolder.asp?action=del&fid= "+FID;
Xmlhttp.open ("Get", url, True);
Xmlhttp.onreadystatechange = Delfolderok;
Xmlhttp.send (NULL);
}
}

function Dellink (LID)
{
if (window.confirm) ("Are you sure you want to delete the selected URL tag?") ") ==true)
{
var url = "Dellink.asp?id=" +lid;
Xmlhttp.open ("Get", url, True);
Xmlhttp.onreadystatechange = Dellinkok;
Xmlhttp.send (NULL);
}
}

function Formate ()
{
if (Window.confirm ("The system clears all the data in your network disk, are you sure you want to continue?") ==true)
{
var url = "Formate.asp?pid" +math.random ();
Xmlhttp.open ("Get", url, True);
Xmlhttp.onreadystatechange = Formateok;
Xmlhttp.send (NULL);
}
}

function Shareok () {
if (xmlhttp.readystate = = 4) {
Gonow ();
Setmsg (' File sharing success! ');
}
}

function Delfolderok () {
if (xmlhttp.readystate = = 4) {
Gonow ();
Setmsg (' Selected folder deleted successfully! ');
}
}

function Delfileok () {
if (xmlhttp.readystate = = 4) {
Gonow ();
Setmsg (' selected file deletion succeeded! ');
}
}

function Dellinkok () {
if (xmlhttp.readystate = = 4) {
Gonow ();
Setmsg (' Selected URL tag deleted successfully! ');
}
}

function Formateok () {
if (xmlhttp.readystate = = 4) {
Showfiles ();
Setmsg (' Net disk data has been completely emptied! ');
}
}

function setmsg (message) {
document.getElementById ("Smessage"). style.display= "Block";
document.getElementById ("MessageBody"). InnerHTML =message;
settimeout (function () {document.getElementById ("smessage"). style.display= "None"},1000);
}


function Editfolder (fid,inputname,inputvalue,share,npwd,pwd) {
document.getElementById (inputvalue). innerhtml= "<font size= ' 2 ' > folder name: </font><input name= '" + inputname+ "' type= ' text ' size= ' value= '" +inputvalue+ "' class= ' InputBox ' ' onmouseover=this.style.background= ' FFF1BB ' onmouseout=this.style.background= ' > <input type= ' checkbox ' name= ' Everyonex ' value= ' yes ' "+share+" > Shared <input type= ' checkbox ' name= ' needpasswordx ' value= ' yes ' +npwd+ ' > Requires password <font ' 2 ' > Access password: size= ><input type= ' password ' value= ' +pwd+ ' ' name= ', ' Passwordinx ' ' size= ' ' class= ' This.style.background= ' #FFF1BB ' onmouseout=this.style.background= ' > <input type= ' button ' class= ' MyButton ' Value= ' edit ' name= ' B1 ' Onclick=editfolder2 (' +escape (inputvalue) + "', '" +fid+ ');> ";
}

function Editfolder2 (Inputname,fid) {
var Foldernamex=document.getelementbyid ("Temp"). Value
var y1x= ' no ';
var y2x= ' no ';
var Pwdx=document.getelementbyid ("Passwordinx"). Value;
if (document.getElementById ("Everyonex"). Checked)
{
Y1x=document.getelementbyid ("Everyonex"). Value;
}
if (document.getElementById ("Needpasswordx"). Checked)
{
Y2x=document.getelementbyid ("Needpasswordx"). Value;
}
if (foldernamex!=undefined)
{
var url = ".. /editfolder.asp?action=editit&rename= "+escape (Foldernamex) +" &everyone= "+y1x+" &needpassword= "+y2x+" &passwordin= "+pwdx+" &foldername=/"+inputname+"/&folderid= "+fid+" &pid= "+Math.random" ();
Xmlhttp.open ("Get", url, True);
Xmlhttp.onreadystatechange = Editfolderok;
Xmlhttp.send (NULL);
}
Else
{
Setmsg (' Edit folder cancellation! ');
}
}

function Editfolderok () {
if (xmlhttp.readystate = = 4) {
Gonow ();
Setmsg (' Edit folder succeeded! ');
}
}

function Editfile (fileid,inputname,inputvalue,fileintro,share) {

document.getElementById (Fileid). innerhtml= "<font size= ' 2 ' > FileName: </font><input size=16 ' Filerename ' class= ' InputBox ' value= ' "+inputvalue+" ' ><font size= ' 2 ' > whether to enjoy </font><input type= ' CheckBox ' name= ' fileshare ' value= ' ture ' "+share+" > <font size= ' 2 ' > Description edit: </font><input size=21 name= ' Fileintro ' class= ' InputBox ' value= ' +fileintro+ ' > <input ' button ' type= ' edit ' value= ' ' name= ' B5 ' class= ' Onclick=editfile2 (' "+fileid+");> ";
}

function Editfile2 (Fileid) {
var Filerename=document.getelementbyid ("Filerename"). Value
var fileshare= ' no ';
var Fileintro=document.getelementbyid ("Fileintro"). Value;

if (document.getElementById ("FileShare"). Checked)
{
Fileshare=document.getelementbyid ("FileShare"). Value;
}

if (filerename!=undefined)
{
var url = ".. /editfile.asp?action=save&rename= "+escape (filerename) +" &share= "+fileshare+" &intro= "+fileintro+" &id= "+fileid;
Xmlhttp.open ("Get", url, True);
Xmlhttp.onreadystatechange = Editfileok;
Xmlhttp.send (NULL);
}
}

function Editfileok () {
if (xmlhttp.readystate = = 4) {
Gonow ();
Setmsg (' Edit file succeeded! ');
}
}

function Checkall (form)
{
for (Var i=0;i<form.elements.length;i++)
{
var e = form.elements[i];
E.checked = True
}
}
function Checkothers (form)
{
for (Var i=0;i<form.elements.length;i++)
{
var e = form.elements[i];
if (E.checked==false)
{
E.checked = true;
}
Else
{
e.checked = false;
}
}
}

function Creatfolder () {
var Foldername=document.getelementbyid ("foldername"). Value;
var y1= ' no ';
var y2= ' no ';
var Pwd=document.getelementbyid ("Passwordin"). Value;

if (document.getElementById ("Everyone"). Checked)
{
Y1=document.getelementbyid ("Everyone"). Value;
}

if (document.getElementById ("Needpassword"). Checked)
{
Y2=document.getelementbyid ("Needpassword"). Value;
}

if (foldername!=undefined)
{
var url = ".. /createfolder.asp?action=create&foldername= "+foldername+" &everyone= "+y1+" &needpassword= "+y2+" & Passwordin= "+PWD;
Xmlhttp.open ("Get", url, True);
Xmlhttp.onreadystatechange = Creatfolderok;
Xmlhttp.send (NULL);
}
}

function Creatfolderok () {
if (xmlhttp.readystate = = 4) {
Hidemenu ();
Gonow ();
Setmsg (' New folder succeeded! ');
}
}

function Addlink () {
var Urlname=document.getelementbyid ("URLName"). Value;
var y1= ' no ';
var Urllocation=document.getelementbyid ("Urllocation"). Value;
if (document.getElementById ("Sharethis"). Checked)
{
Y1=document.getelementbyid ("Sharethis"). Value;
}
if (urlname!=undefined)
{
var url = "Addlink.asp?uname=" +urlname+ "&share=" +y1+ "&uloction=" +urllocation;
Xmlhttp.open ("Get", url, True);
Xmlhttp.onreadystatechange = Addlinkok;
Xmlhttp.send (NULL);
}
}

function Addlinkok () {
if (xmlhttp.readystate = = 4) {
Hidemenu1 ();
Gonow ();
setmsg (' URL tag added successfully! ');
}
}

function Movefiles () {
var fileid= "";
var obj=document.getelementsbyname (' Myselect ');
for (Var i=0 i < obj.length; i++) {
if (obj[i].checked)
Fileid=fileid+obj[i].value+ ', ';
}
if (Fileid)
{
var Foldername=document.getelementbyid ("folder"). Value;
var url = ".. /moveitok.asp?action=createbyurl&folder= "+foldername+" &my_select= "+fileid;
Xmlhttp.open ("Get", url, True);
Xmlhttp.onreadystatechange = Movefilesok;
Xmlhttp.send (NULL);
}
Else
{
Alert ("Please select File First!");
}
}

function Movefilesok () {
if (xmlhttp.readystate = = 4) {
Hidemenu ();
Gonow ();
Setmsg (' File move succeeded! ');
}
}

var showl=true;

function Showmenu2 () {
document.getElementById ("Movefiles"). style.display= "Block";
document.getElementById (' Movefiles '). style.height=20;
}
function showmenu1 () {
document.getElementById ("CreateFolder"). style.display= "Block";
document.getElementById (' CreateFolder '). style.height=20;
}

function Showmenu4 () {
document.getElementById ("Addlink"). style.display= "Block";
document.getElementById (' Addlink '). style.height=20;
}

function Showmenu3 () {
if (Showl!= false)
{
document.getElementById (' Showloctionx '). innerhtml= " ";
document.getElementById ("Mylocation"). style.display= "Block";
document.getElementById (' mylocation '). style.height=20;
Showl=false
}
Else
{
document.getElementById (' Showloctionx '). innerhtml= " ";
document.getElementById ("Mylocation"). style.display= "None";
Showl=true;
}

}

function Hidemenu () {
document.getElementById ("Movefiles"). style.display= "None";
document.getElementById ("CreateFolder"). style.display= "None";
}

function hidemenu1 () {
document.getElementById ("Addlink"). style.display= "None";
}

function Setorderby () {
var Orderby=document.getelementbyid ("by"). Value;
var url = "setorderby.asp?setby=" +orderby+ "&pid=" +math.random ();
Xmlhttp.open ("Get", url, True);
Xmlhttp.onreadystatechange = Setorderbyok;
Xmlhttp.send (NULL);
}

function Setorderbyok () {
if (xmlhttp.readystate = = 4) {
Gonow ();
Setmsg (' File sorting settings successful! ');
}
}


function Editlink (linkid,urlname,urlloction,share) {
document.getElementById (LinkId). innerhtml= "<font size= ' 2 ' > tag name: </font><input size=13 name= ' Editlinkname ' class= ' InputBox ' value= ' "+urlname+" ' ><font size= ' 2 ' > whether to enjoy </font><input type= ' CheckBox ' name= ' editlinkshare ' value= ' yes ' ' +share+ ' > <font size= ' 2 ' > Web site edit: </font><input size=25 Name= ' editlinkloaction ' class= ' InputBox ' value= ' +urlloction+ ' ' > <input type= ' button ' value= ' edit ' name= ' B5 ' class= ' MyButton ' Onclick=editlink2 (' +escape (LinkId) + "');>";
}

function Editlink2 (LINKIDX) {
var Urlname=document.getelementbyid ("Editlinkname"). Value;
var linkshare= ' no ';
var Urlloction=document.getelementbyid ("Editlinkloaction"). Value;
if (document.getElementById ("Editlinkshare"). Checked)
{
Linkshare=document.getelementbyid ("Editlinkshare"). Value;
}
if (urlname!=undefined)
{
var url = "Editlink.asp?uname=" +urlname+ "&share=" +linkshare+ &uloction= "+urlloction+" &id= "+linkidx+" &pid= "+math.random ();
Xmlhttp.open ("Get", url, True);
Xmlhttp.onreadystatechange = Editlinkok;
Xmlhttp.send (NULL);
}
}

function Editlinkok () {
if (xmlhttp.readystate = = 4) {
Gonow ();
Setmsg (' Edit URL tag success! ');
}
}

function Highlightme (o) {
O.parentnode.parentnode.style.backgroundcolor = (o.checked)? " #FFEBD7 ":" "
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.