ASP FAQs and Answers (4)

Source: Internet
Author: User
Tags servervariables trim visibility
Answer | Question 1. Take the full address of the current page to return to the
<%
Function GetUrl ()
On Error Resume Next
Dim strtemp
If LCase (Request.ServerVariables ("HTTPS") = "Off" Then
strtemp = "http://"
Else
strtemp = "https://"
End If
strtemp = strtemp & Request.ServerVariables ("SERVER_NAME")
If Request.ServerVariables ("Server_port") <> Then strtemp = strtemp & ":" & Request.ServerVariables ("SER Ver_port ")
strtemp = strtemp & Request.ServerVariables ("URL")
If Trim (request.querystring) <> "" Then strtemp = strtemp & "?" & Trim (Request.QueryString)
GETURL = strtemp
End Function
' Response.Write GetUrl ()
Url1=geturl ()
Url1=server.urlencode (URL1)

%>



2. When uploading files, show progress bar Program

On the same surface that needs to refer to the progress bar.
<script language= "javascript" src= ". /showprocessbar.js "></script>

And then
<input type= "Submit" value= "Start uploading" name= "B1" isshowprocessbar= "True" >
Pass parameter True

Showprocessbar.js
—————————————————————————————————————————
Addprocessbar ();
var bwidth=0;
var swidth = document.all.waiting.clientWidth;

function Checkisprocessbar (obj)
{
if (obj. isshowprocessbar== "True")
{
return false;
}
Else
{
return true;
}
}

function Checkclick (e)
{
if (e = = 1)
{
if (bwidth<swidth*0.98) {
Bwidth + + (swidth-bwidth) * 0.025;
if (document.all) document.sbar.width = bwidth;
else document.rating.clip.width = bwidth;
SetTimeout (' Checkclick (1); ', 1000);

}
}
Else
{
if (document.all)
{
if (document.all.waiting.style.visibility = = ' Visible ')
{document.all.waiting.style.visibility = ' hidden ';
Bwidth = 1;}
Whichit = event.srcelement;

while (Checkisprocessbar (Whichit))
{
Whichit = whichit.parentelement;
if (Whichit = null) return true;
}


Document.all.waiting.style.pixelTop = (document.body.offsetheight-document.all.waiting.clientheight)/2 + Document.body.scrollTop;
Document.all.waiting.style.pixelLeft = (document.body.offsetwidth-document.all.waiting.clientwidth)/2 + Document.body.scrollLeft;
document.all.waiting.style.visibility = ' visible ';
if (!bwidth) Checkclick (1);
Bwidth = 1;

}

Else
{

if (document.waiting.visibility = = ' Show ')
{document.waiting.visibility = ' hide ';
document.rating.visibility = ' hide ';
Bwidth = 1;}
if (e.target.href.tostring ()!= ')
{
Document.waiting.top = (window.innerheight-document.waiting.clip.height)/2 + Self.pageyoffset;
Document.waiting.left = (window.innerwidth-document.waiting.clip.width)/2 + Self.pagexoffset;
document.waiting.visibility = ' show ';
Document.rating.top = (window.innerheight-document.waiting.clip.height)/2 + self.pageyoffset+ document.waiting.clip.height-10;
Document.rating.left = (window.innerwidth-document.waiting.clip.width)/2 + Self.pagexoffset;
document.rating.visibility = ' show ';
if (!bwidth) Checkclick (1);
Bwidth = 1;
}
}
return true;
}
}

function Addprocessbar ()
{

var str= ""
str+= "<div id=waiting style=position:absolute;top:50px;left:100px;z-index:1;visibility:hidden >";
str+= "<layer name=waiting visibility=visible zindex=2 >"
str+= "<table border=2 cellspacing=1 cellpadding=0 bordercolorlight= #FFFFFF bordercolordark= #C0C0C0 bgcolor=# E0e0e0> "
str+= "<tr>"
str+= "<td bgcolor= #E0E0E0 height=30px width=300px align=center>"
str+= "<font color=black> data is being processed ...</font>"
str+= "</td>"
str+= "</tr>"
str+= "<tr>"
str+= "<td bgcolor= #E0E0E0 >"
str+= "str+= "</td>"
str+= "</tr>"
str+= "</table>"
str+= "</layer>"
str+= "</div>"
document.write (STR)

if (document.all) Document.onclick = Checkclick;
}



3. Control scrolling:
=============

<meta



Related Article

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.