一些常用的辅助代码很实用很基本也较全面了.docx

上传人:b****7 文档编号:10764363 上传时间:2023-02-22 格式:DOCX 页数:14 大小:25.57KB
下载 相关 举报
一些常用的辅助代码很实用很基本也较全面了.docx_第1页
第1页 / 共14页
一些常用的辅助代码很实用很基本也较全面了.docx_第2页
第2页 / 共14页
一些常用的辅助代码很实用很基本也较全面了.docx_第3页
第3页 / 共14页
一些常用的辅助代码很实用很基本也较全面了.docx_第4页
第4页 / 共14页
一些常用的辅助代码很实用很基本也较全面了.docx_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

一些常用的辅助代码很实用很基本也较全面了.docx

《一些常用的辅助代码很实用很基本也较全面了.docx》由会员分享,可在线阅读,更多相关《一些常用的辅助代码很实用很基本也较全面了.docx(14页珍藏版)》请在冰豆网上搜索。

一些常用的辅助代码很实用很基本也较全面了.docx

一些常用的辅助代码很实用很基本也较全面了

一些常用的辅助代码(很实用很基本也较全面了)  字体:

[大][中][小] [2005-11-16|作者:

admin|来自:

本站原创]

收藏此页到:

天天|和讯|博采|ViVi|狐摘|我摘|天极 RSS在线订阅:

||

点击返回上页代码:

弹出警告框代码:

--

function AlertButton(){window.alert("要多多光临呀!

");}

// -->

点击打开新窗口

--

function NewWindow(){window.open("","","height=240,width=340,status=no,location=no,toolbar=no,directories=no,menubar=no");}

// -->

删除记录时弹出确认框:

 

a=msgbox("真的要删除该记录吗?

",1,"注意")

if a=1 then

location="Dodelete.asp?

id=<%=id%>" //指向执行删除的页面Dodelete.asp

else 

history.go(-1)

end if

关闭打开的窗口 

< a href="/" onclick="javascript:

window.close(); return false;">关闭窗口 

清空INPUT且选定

onClick="Javascript:

this.value=''" onFocus="this.select()" onMouseOver="this.focus()"

右键屏蔽

连串英文自动换行的解决方法 IE5.5

style="LEFT:

 0px; WIDTH:

 100%; WORD-WRAP:

 break-word" 你可修改为指定的大小如 200px 

图片“重置”按钮

function myreset()

{ document.login.reset();

document.login.focus();}

画细线表格

 collapse"> 

状态栏信息

--

function StatusButton(){window.status="要多多光临呀!

";}

// -->

最小化、最大化、关闭窗口

ADB880A6-D8FF-11CF-9377-00AA003B7A11"> 

ADB880A6-D8FF-11CF-9377-00AA003B7A11"> 

adb880a6-d8ff-11cf-9377-00aa003b7a11">

本例适用于IE

隐藏状态栏里出现的LINK信息 

//"; onMouseOver="window.s ... ;;return true">梦想天空 

文本框自动滚动条

1 solid #000000;background-color:

white; font-size:

9pt; width:

188; overflow:

auto" wrap=hard>

全选并复制

HighlightAll('test.select1')" type=button value=全选并复制>
你好,欢迎您的光临!

 

 

-- 

var copytoclip=1 

function HighlightAll(theField) { 

var tempval=eval("document."+theField) 

tempval.focus() 

tempval.select() 

if (document.all&©toclip==1){ 

therange=tempval.createTextRange() 

therange.execCommand("Copy") 

window.status="Contents highlighted and copied to clipboard!

setTimeout("window.status=''",1800) 

//--> 

屏蔽JAVASCRIPT错误

--

function killErrors(){

return true;

}

window.onerror = killErrors;

-->

关闭子窗口时刷新父窗口 

--

self.opener.location.reload();

window.close()

-->

背景色变换

检查一段字符串是否全由数字组成 

-- 

function checkNum(str){return str.match(//D/)==null} 

alert(checkNum("1232142141")) 

alert(checkNum("123214214a1")) 

// --> 

判断是否是字符 

if (/[^/x00-/xff]/g.test(s)) alert("含有汉字"); 

点击刷新代码:

--

function ReloadButton(){location.href="allbutton.htm";}

// -->

让层不被控件复盖代码:

2>

 # 前面 

1>

 # 后面 

absolute; top:

40;width:

400px; height:

95px;z-index:

2">

absolute; top:

50;width:

200px; height:

115px;z-index:

1"> 

让层的相对定位 

relative; left:

0px; top:

0px; width:

0px; height:

0px;z-index:

1"> 

absolute; left:

500px; top:

0px; width:

220px; height:

220px; z-index:

1"> 

内容

Flash代码以及背景透明

D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=" ... h/swflash.cab#version=6,0,29,0" width="200" height="200">

 

Windows Media Player 播放器

style="LEFT:

 0px; VISIBILITY:

 visible; POSITION:

 absolute; TOP:

 0px;z-index:

2" 

codeBase=

Loading 

type=application/x-oleobject height=300 width=320 

classid=CLSID:

6BF52A52-394A-11d3-B153-00C04F79FAA6 VIEWASTEXT>

RealPlayer 播放器

CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" 

width=320 height=240 align="middle">

src="地址" 

type="audio/x-pn-realaudio-plugin" console="chip1" 

controls="imagewindow" width=320 height=240 autostart=true align="middle">

 

---------------------------------------------------------------

---------------------------------------------------------------

1.如何用Asp判断你的网站的虚拟物理路径 

答:

使用Mappath方法 

< p align="center" >< font size="4" face="Arial" >< b > 

The Physical path to this virtual website is:

 

< /b >< /font > 

< font color="#FF0000" size="6" face="Arial" > 

< %= Server.MapPath("\")% > 

< /font >< /p > 

2.我如何知道使用者所用的浏览器?

 

答:

使用the Request object方法 

strBrowser=Request.ServerVariables("HTTP_USER_AGENT") 

If Instr(strBrowser,"MSIE") < > 0 Then 

  Response.redirect("ForMSIEOnly.htm") 

Else 

  Response.redirect("ForAll.htm") 

End If 

3.如何计算每天的平均反复访问人数 

答:

解决方法 

< % startdate=DateDiff("d",Now,"01/01/1990") 

if strdate< 0 then startdate=startdate*-1 

avgvpd=Int((usercnt)/startdate) % > 

显示结果 

< % response.write(avgvpd) % > 

that is it.this page have been viewed since November 10,1998 

4.如何显示随机图象 

< % dim p,ppic,dpic 

ppic=12 

randomize 

p=Int((ppic*rnd)+1) 

dpic="graphix/randompics/"&p&".gif" 

% > 

显示 

< img src="< %=dpic% >" > 

5.如何回到先前的页面 

答:

< a href="< %=request.serverVariables("Http_REFERER")% >" >preivous page< /a > 

或用图片如:

< img src="arrowback.gif" alt="< %=request.serverVariables("HTTP_REFERER")% >" > 

6.如何确定对方的IP地址 

答:

< %=Request.serverVariables("REMOTE_ADDR)% > 

7.如何链结到一副图片上 

答:

< % @Languages=vbs cript % > 

< % response.expires=0 

strimagename="graphix/errors/erroriamge.gif" 

r

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 农林牧渔 > 农学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1