分享
 
 
 

ASP精华问题4

王朝asp·作者佚名  2006-12-16
窄屏简体版  字體: |||超大  

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 http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>无标题文档</title>

</head>

<body style="margin:0px">

<table width="110" border="0" align="center" cellpadding="2" cellspacing="0" height="300px">

<tr>

<td id="i">

<marquee id="mar" direction="up" behavior="slide" height="100px" style="background-Color:#00ff00">

<div style="background-Color:#ff0000" id="div">

<p><a href="#">分类一</a></p>

<p>分类二</p>

<p>分类三</p>

<p>分类四</p>

<p>分类五</p>

<p>分类六</p>

</div>

</marquee>

<div id="div"></div>

</td>

</tr>

<tr>

<td>

<input type="button" name="btnUp" value="向上" onMouseOver="UpScroll();" onMouseOut="StopScroll();">

<input name="btnDown" type="button" value="向下" onMouseOver="DownScroll();" onMouseOut="StopScroll();">

</td>

</tr>

</table>

<script language="JavaScript">

var timer;

var mar = document.all.mar;

var div = document.all.div;

var h1 = div.offsetHeight;

var h2 = mar.height;

//向上移动

function UpMarquee(){

if(mar.scrollTop>=h1)

StopScroll();

else

mar.scrollTop+=1;

}

function DownMarquee(){

if(mar.scrollTop<=h2)

StopScroll();

else

mar.scrollTop-=1;

//alert(mar.scrollTop);

}

//循环调用向下移动函数

function UpScroll(){

//alert(mar.scrollTop);

//StopScroll();

timer = setInterval('UpMarquee()',50);//循环调用

}

//循环调用向上移动函数

function DownScroll(){

//StopScroll();

timer = setInterval('DownMarquee()',50);//循环调用

}

//清除循环调用

function StopScroll(){

clearInterval(timer);

}

</script>

</body>

</html>

检查时间:

================

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title></title>

<script language="JavaScript">

function isValid(vlu)

{

var tmp1 = "";

var i = 0;

var bool = true;

vlu += ":";

i = vlu.indexOf(":");

tmp = vlu.substr(0,i);

vlu = vlu.substr(i+1,vlu.length);

bool = isErr(tmp) & isErr1(tmp) & isErr2(tmp);

i = vlu.indexOf(":");

tmp = vlu.substr(0,i);

vlu = vlu.substr(i+1,vlu.length);

bool &= isErr(tmp) & isErr1(tmp) & isErr3(tmp);

i = vlu.indexOf(":");

tmp = vlu.substr(0,i);

vlu = vlu.substr(i+1,vlu.length);

bool &= isErr(tmp) & isErr1(tmp) & isErr3(tmp);

if(bool == true)

alert("ok.");

else

alert("The time is incorrect.");

}

function isErr(vlu)

{

var bool = vlu.indexOf("-") >= 0 ? false : true;

bool &= vlu.indexOf(".") >= 0 ? false : true;

return bool;

}

function isErr1(vlu)

{

return isNaN(parseInt(vlu)) ? false : true;

}

function isErr2(vlu)

{

return parseInt(vlu) > 23 ? false : true;

}

function isErr3(vlu)

{

return parseInt(vlu) > 59 ? false : true;

}

//isValid("25:59:00");

</script>

</head>

<body>

<input name="txtTime" type="text" id="txtTime" value="09:05:59">

<input type="button" name="Submit" value="°&acute;&Aring;&yen;" onClick="isValid(document.all.txtTime.value);">

</body>

</html>

||||||4.调用Css做颜色变换:

======================

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>&Icirc;&THORN;±ê&Igrave;&acirc;&Icirc;&Auml;&micro;&micro;</title>

<style type="text/css">

<!--

.red {

background-color: #FF0000;

}

.blue {

background-color: #0000FF;

}

.yellow {

background-color: #FFFF00;

}

.green {

background-color: #00FF00;

}

.black {

background-color: #000000;

}

.white {

background-color: #FFFFFF;

}

.cyan {

background-color: #00FFFF;

}

.purple {

background-color: #FF00FF;

}

-->

</style>

<script language="javascript">

var timer;

var arrColor = new Array("red","green","yellow","blue","black","white","cyan","purple");

var index1 = 0;

var index2 = 7;

function ChangeColor1()

{

for(var i=0; i<8; i++)

{

if(index1 == 8) index1 = 0;

document.all('t'+(i+1)).className = arrColor[index1];

document.all('b'+(i+1)).innerText = document.all('t'+(i+1)).className;

document.all('b'+(i+1)).style.color = arrColor[index1++];

}

if(index1 == 8) index1 = 0;

index1++;

}

function ChangeColor2()

{

for(var i=8; i>0; i--)

{

if(index2 == 0) index2 = 8;

document.all('c'+i).className = arrColor[--index2];

document.all('f'+i).innerText = document.all('c'+i).className;

document.all('f'+i).style.color = arrColor[index2];

}

if(index2 == 0) index2 = 8;

--index2;

}

</script>

</head>

<body onLoad="setInterval('ChangeColor1()',500);setInterval('ChangeColor2()',500);">

<table width="720" border="1" align="center" cellpadding="0" cellspacing="0">

<colgroup>

<col width="12.5%">

<col width="12.5%">

<col width="12.5%">

<col width="12.5%">

<col width="12.5%">

<col width="12.5%">

<col width="12.5%">

<col width="12.5%">

</colgroup>

<tr>

<td id="t1" class="red" height="30"> </td>

<td id="t2" class="green"> </td>

<td id="t3

[1] [2] 下一页

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有