ASP常见问题及解答(4)

解答|问题

1.取当前网页的地址全名,以便返回用
<%
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") <> 80 Then strTemp = strTemp & ":" & Request.ServerVariables("SERVER_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.上传文件时,显示进度条程序

在需要引用进度条的也面上用
<script language="javascript" src="../ShowProcessBar.js"></script>

然后,
<input type="submit" value="开始上传" name="B1" IsShowProcessBar="True">
传参数 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>数据正在处理中...</font>"
Str+= " </td>"
Str+= " </tr>"
Str+= " <tr>"
Str+= " <td bgcolor=#E0E0E0>"
Str+= " <img width=1 height=10 name=sbar style=background-color:#6699cc>"
Str+= " </td>"
Str+= " </tr>"
Str+= "</table> "
Str+= "</layer>"
Str+= "</div>"
document.write(Str)

if(document.all)document.onclick = CheckClick;
}

3.控制滚动:
=============

<html>
<head>
<meta

时间: 2025-01-01 07:58:44

ASP常见问题及解答(4)的相关文章

ASP常见问题及解答(10)

解答|问题 1.关于<table>折行:<table style="TABLE-LAYOUT: fixed" width="200" border="0" cellspacing="0" cellpadding="7" bgcolor="#f7f7f7"><tr> <td style="LEFT: 0px; WIDTH: 100%; W

ASP常见问题及解答(11)

解答|问题 常用的javascript function//=========================================//输入数据检验//检验空值function funCheckEmpty(m_Text) {var strTmp=m_Textif (strTmp == null || strTmp == "") {return false}return true} //检验内容的长度function funTextLenCheck(m_Text) {var s

ASP常见问题及解答(2)

解答|问题 1. oncontextmenu="window.event.returnvalue=false" 将彻底屏蔽鼠标右键<table border oncontextmenu=return(false)><td>no</table> 可用于Table 2. <body onselectstart="return false"> 取消选取.防止复制 3. onpaste="return false&q

ASP常见问题及解答(6)

解答|问题 1.防止用户直接访问页面(防止自制表单提交,直接通过链接访问)function checkPrePage()url=request.ServerVariables("HTTP_REFERER")url=trim(replace(url,"http://",""))url=trim(left(url,len(request.ServerVariables("SERVER_NAME"))))if url<>

ASP常见问题及解答(7)

解答|问题 1.分 类:语法应用问题描述:查找两个字符串间的字符出现次数解决办法: function FindStringTimes(strContent,start_string,end_string) 'start_string 与 end_string 之间字符出次的数'written by JaronFindStringTimes = ubound(split(strContent,start_string))end function 示例: 查找以下字符串有多少张图片response.

ASP常见问题及解答(1)

解答|问题 1.如何 最小化.最大化.关闭窗口答:<objectid=hh1classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"><paramname="command"value="minimize"></object><objectid=hh2classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a

ASP常见问题及解答(3)

解答|问题 1.图片显示控制:<script language="JavaScript"><!--var flag=false;function DrawImage(ImgD){ var image=new Image(); image.src=ImgD.src; if(image.width>0 && image.height>0){ flag=true; if(image.width/image.height>= 360/270)

ASP常见问题及解答(8)

解答|问题 1.表格排序表格排序是对表格而言的,与表格的生成无关.就是说,无论用何种方式产生的表格排序时都一样.这是排序函数,很简单.分升序和降序,要求传入参数:obj 表格名或id; n 排序列,第一列为0<script>function table_sort_asc(obj,n) { var i,j; var tab = eval("document.all."+obj); if(tab.tagName != "TABLE") return; for

ASP常见问题及解答(9)

解答|问题 1.[打开]命令的实现 [格式]:document.execCommand("open") [说明]这跟VB等编程设计中的webbrowser控件中的命令有些相似,大家也可依此琢磨琢磨. [举例]在<body></body>之间加入: <a href="#" onclick=document.execCommand("open")>打开</a> 2.[使用 记事本 编辑]命令的实现 [格