1. asp与access数据库连接:
dim conn,mdbfile mdbfile=server.mappath("数据库名称.mdb") set conn=server.createobject("adodb.connection") conn.open "driver={microsoft access driver (*.mdb)};uid=admin;pwd=数据库密码;dbq="&mdbfile conn.open "provider = microsoft.jet.oledb.4.0;data source = " & mdbfile 2. asp与sql数据库连接: dim conn set conn=server.createobject("adodb.connection") con.open "provider=sqloledb;data source=sql服务器名称或ip地址;uid=sa;pwd=数据库密码;database=数据库名称;" 建立记录集对象: set rs=server.createobject("adodb.recordset") rs.open sql语句,conn,3,2 sql常用命令使用方法: 数据记录筛选: sql="select * from 数据表 where 字段名=字段值 order by 字段名 " sql="select * from 数据表 where 字段名 like ‘%字段值%‘ order by 字段名 " sql="select top 10 * from 数据表 where 字段名 order by 字段名 " sql="select * from 数据表 where 字段名 in (‘值1‘,‘值2‘,‘值3‘)" sql="select * from 数据表 where 字段名 between 值1 and 值2" 更新数据记录: sql="update 数据表 set 字段名=字段值 where 条件表达式" sql="update 数据表 set 字段1=值1,字段2=值2 …… 字段n=值n where 条件表达式" 删除数据记录: sql="delete from 数据表 where 条件表达式" sql="delete from 数据表" (将数据表所有记录删除) 添加数据记录: sql="insert into 数据表 (字段1,字段2,字段3 …) valuess (值1,值2,值3 …)" sql="insert into 目标数据表 select * from 源数据表" (把源数据表的记录添加到目标数据表) 数据记录统计函数: avg(字段名) 得出一个表格栏平均值 count(*|字段名) 对数据行数的统计或对某一栏有值的数据行数统计 max(字段名) 取得一个表格栏最大的值 min(字段名) 取得一个表格栏最小的值 sum(字段名) 把数据栏的值相加 引用以上函数的方法: sql="select sum(字段名) as 别名 from 数据表 where 条件表达式" set rs=conn.excute(sql) 用 rs("别名") 获取统的计值,其它函数运用同上。 数据表的建立和删除: create table 数据表名称(字段1 类型1(长度),字段2 类型2(长度) …… ) 例:create table tab01(name varchar(50),datetime default now()) drop table 数据表名称 (永久性删除一个数据表) 记录集对象的方法: rs.movenext 将记录指针从当前的位置向下移一行 rs.moveprevious 将记录指针从当前的位置向上移一行 rs.movefirst 将记录指针移到数据表第一行 rs.movelast 将记录指针移到数据表最后一行 rs.absoluteposition=n 将记录指针移到数据表第n行 rs.absolutepage=n 将记录指针移到第n页的第一行 rs.pagesize=n 设置每页为n条记录 rs.pagecount 根据 pagesize 的设置返回总页数 rs.recordcount 返回记录总数 rs.bof 返回记录指针是否超出数据表首端,true表示是,false为否 rs.eof 返回记录指针是否超出数据表末端,true表示是,false为否 rs.delete 删除当前记录,但记录指针不会向下移动 rs.addnew 添加记录到数据表末端 rs.update 更新数据表记录 判断所填数据是数字型 if not isnumeric(request("字段名称")) then response.write "不是数字" else response.write "数字" end if页面执行时间: <%startime = timer()%> .... .... 内容 ... ... 结尾 <% dim endtime endtime = timer() response.write "页面执行时间:<font color=red>"&formatnumber((endtime-startime)*1000,5)&"</font> 毫秒" %>定义打开网页时起始窗口的大小 <script for="window" event="onload"> window.resizeto(500,300) </script> 随机数: <%randomize%> <%=(int(rnd()*n)+1)%> 查询数据时得到的记录关键字用红色显示: replace(rs("字段x"),searchname,"<font color=#ff0000>" & searchname & "</font>") 通过asp的手段来检查来访者是否用了代理 <% if request.servervariables("http_x_forwarded_for")<>"" then response.write "<font color=#ff0000>您通过了代理服务器,"& _ "真实的ip为"&request.servervariables("http_x_forwarded_for") end if %> 判断上一页的来源 request.servervariables("http_referer") javascript: document.referrer 清除缓存,重新加载页面 <%response.expires = 0 response.expiresabsolute = now() - 1 response.addheader "pragma","no-cache" response.addheader "cache-control","private" response.cachecontrol = "no-cache" %> 检索并删除数据库里的重复记录 conn.execute("delete from table where id not in (select distinct from table)") 文件删除函数 <% 文件删除函数 function deletefile(filename) if filename<>"" then set fso=server.createobject("scripting.filesystemobject") if fso.fileexists(filename) then fso.deletefile filename else response.write "<script>alert(’该文件不存在’);</script>" end if end if end function strfile=server.mappath("filename") deletefile(strfile) %> asp字数计算函数 <% function wordcount(strinput) dim strtemp strtemp = replace(strinput, vbtab, " ") strtemp = replace(strtemp, vbcr, " ") strtemp = replace(strtemp, vblf, " ") 删除字首字尾空格 strtemp = trim(strtemp) 替换为一个空格 do while instr(1, strtemp, " ", 1) <> 0 strtemp = replace(strtemp, " ", " ") loop wordcount = ubound(split(strtemp, " ", -1, 1)) +1 end function %>全正则的检测ip是否合法的函数 function checkip2(sipaddress) { var exp=/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/; var reg = sipaddress.match(exp); var errmsg="你输入的是一个非法的ip地址段!\nip段为::xxx.xxx.xxx.xxx(xxx为0-255)!" var msg="你输入的是一个合法的ip地址段!" if(reg==null) { alert(errmsg); } else { alert(reg); } } 关闭子窗口时刷新父窗口 在子窗口 <script language="javascript"> window.opener.location="父窗口页面" window.close() </script> 文本框输入限制: <script> function reginput(obj, reg, inputstr) { var docsel = document.selection.createrange() if (docsel.parentelement().tagname != "input") return false osel = docsel.duplicate() osel.text = "" var srcrange = obj.createtextrange() osel.setendpoint("starttostart", srcrange) var str = osel.text + inputstr + srcrange.text.substr(osel.text.length) return reg.test(str) } </script> 小写英文:<xmp style= "display:inline"> </xmp> <input onkeypress = "return reginput(this, /^[a-z]*$/, string.fromcharcode(event.keycode))" onpaste = "return reginput(this, /^[a-z]*$/, window.clipboarddata.getdata(text))" ondrop = "return reginput(this, /^[a-z]*$/, event.datatransfer.getdata(text))" style="ime-mode:disabled" ><br> 大写英文:<xmp style= "display:inline"> </xmp> <input onkeypress = "return reginput(this, /^[a-z]*$/, string.fromcharcode(event.keycode))" onpaste = "return reginput(this, /^[a-z]*$/, window.clipboarddata.getdata(text))" ondrop = "return reginput(this, /^[a-z]*$/, event.datatransfer.getdata(text))" style="ime-mode:disabled"> <br> 任意数字:<xmp style="display:inline"> </xmp> <input onkeypress = "return reginput(this, /^[0-9]*$/, string.fromcharcode(event.keycode))" onpaste = "return reginput(this, /^[0-9]*$/, window.clipboarddata.getdata(text))" ondrop = "return reginput(this, /^[0-9]*$/, event.datatransfer.getdata(text))" style="ime-mode:disabled" ><br> 限2位小数:<xmp style="display:inline"> </xmp> <input onkeypress = "return reginput(this, /^\d*\.?\d{0,2}$/, string.fromcharcode(event.keycode))" onpaste = "return reginput(this, /^\d*\.?\d{0,2}$/, window.clipboarddata.getdata(text))" ondrop = "return reginput(this, /^\d*\.?\d{0,2}$/, event.datatransfer.getdata(text))" style="ime-mode:disabled" > 如: 123.12<br> 日 期:<xmp style="display:inline"> </xmp> <input onkeypress = "return reginput(this, /^\d{1,4}([-\/](\d{1,2}([-\/](\d{1,2})?)?)?)?$/, string.fromcharcode(event.keycode))" onpaste = "return reginput(this, /^\d{1,4}([-\/](\d{1,2}([-\/](\d{1,2})?)?)?)?$/, window.clipboarddata.getdata(text))" ondrop = "return reginput(this, /^\d{1,4}([-\/](\d{1,2}([-\/](\d{1,2})?)?)?)?$/, event.datatransfer.getdata(text))" style="ime-mode:disabled" > 如: 2002-9-29<br> 任意中文:<xmp style="display:inline"> </xmp> <input onkeypress = "return reginput(this, /^$/, string.fromcharcode(event.keycode))" onpaste = "return reginput(this, /^[\u4e00-\u9fa5]*$/, window.clipboarddata.getdata(text))" ondrop = "return reginput(this, /^[\u4e00-\u9fa5]*$/, event.datatransfer.getdata(text))" ><br> 部分英文:<xmp style="display:inline"> </xmp> <input onkeypress = "return reginput(this, /^[a-e]*$/, string.fromcharcode(event.keycode))" onpaste = "return reginput(this, /^[a-e]*$/, window.clipboarddata.getdata(text))" ondrop = "return reginput(this, /^[a-e]*$/, event.datatransfer.getdata(text))" style="ime-mode:disabled" > 范围: a,b,c,d,e<br> 部分中文:<xmp style="display:inline"> </xmp> <script language=javascript> function checkchinese(oldlength, obj) { var otr = window.document.selection.createrange() var reg = /[^一二三四五六七八九十]/g otr.movestart("character", -1*(obj.value.length-oldlength)) otr.text = otr.text.replace(reg, "") } </script> <input onkeypress="return false" onkeydown="settimeout(checkchinese(+this.value.length+,+this.uniqueid+), 1)" onpaste = "return reginput(this, /^[一二三四五六七八九十]*$/, window.clipboarddata.getdata(text))" ondrop = "return reginput(this, /^[一二三四五六七八九十]*$/, event.datatransfer.getdata(text))" > 范围: 一二三四五六七八九十<br> 不能点右键,不用ctrl+a,不能复制作! <body oncontextmenu="window.event.returnvalue=false" onkeypress="window.event.returnvalue=false" onkeydown="window.event.returnvalue=false" onkeyup="window.event.returnvalue=false" ondragstart="window.event.returnvalue=false" onselectstart="event.returnvalue=false"> </body> 显示状态拦固定文字: 放在body前 <base onmouseover="window.status=这里是goaler的blog系统,欢迎访问;return true"> 用键盘打开网页 <script language=javascript> document.onkeydown=gopage var add="admin/addarticle.asp" var logon="admin/logon.asp" function gopage() { if (event.keycode==13) location=add if (event.keycode==38) location=logon } </script> 根据内容自动调整iframe高度 有时为了方便使用iframe,但被潜入的页面长度不是固定的,显示滚动条不仅影响美观还对用户操作带来不便,自动调整高度可以解决这个问题。^_^ function f_framestyleresize(targobj) { var targwin = targobj.parent.document.all[targobj.name]; if(targwin != null) { var heightvalue = targobj.document.body.scrollheight if(heightvalue < 600){heightvalue = 600} //不小于600 targwin.style.pixelheight = heightvalue; } } function f_iframeresize() { bloadcomplete = true; f_framestyleresize(self); } var bloadcomplete = false; window.onload = f_iframeresize; 禁止页面正文内容被选取 <body oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false"onmouseup="document.selection.empty()"> 消除ie6自动出现的图像工具栏,设置 galleryimg属性为false或no . <img src="mypicture.jpg" height="100px" width="100px" galleryimg="no"> 防止点击空链接时,页面往往重置到页首端。 代码“javascript:void(null)”代替原来的“#”标记 如何避免别人把你的网页放在框架中 <script language=“javascript”><!--if (self!=top){top.location=self.location;} -->< /script> 页面定时刷新 <meta http-equiv="refresh" content="秒" > 页面定时转向新的地址 <meta http-equiv="refresh" content="秒;url=url"> 关闭窗口,这个是不会弹出提示直接关的: 把如下代码加入<body>区域中 <object id=closes type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"> <param name="command" value="close"> </object> <script language="javascript">function shutwin(){closes.click();return;}</script> <a href="javascript:shutwin();">关闭本窗口</a> 有时候好不容易写出来的程序代码被别人抄去,心里一定不好受。这还是小事,但如果在我们的源代码中有一些不希望让别人知道的内容,比如密码、action的指向等,这些一旦被人利用,那后果有时是不堪设想的。而网页加密就是我们现在需要解决的问题。下面就我在网页制作中的一些经验向大家介绍一些简单的防范方法。 禁止右键 看到这里大家一定会想,这招有很多人介绍过了,而且破解的方法也有很多。但我这里要说的是另一种方法,而且我试了很多方法都没有能破解。具体如下: <html> <head> <script> function stop(){ alert("试试能破解吗?"); return false; } document.oncontextmenu=stop; </script> <boyd>你可以按右键、shift+f10和右ctrl左边的那个键试试!看能不能解。^_^</body> 大家试试,看能不能破解!你可以将alert("试试能破解吗?");这句去掉,这样当按右键时就什么反应也没有了,就好像没有右键功能一样。 禁示查看源代码 我们已经禁了右键,但从"查看"菜单下的"源文件"中同样可以看到源代码,下面我们就来解决这个问题: 其实这只要使用一个含有<frame></frame>标记的网页便可以达到目的。 <frameset> <frame src="你要保密的文件的url"> </frameset> 这样当有人使用"查看"下的"源文件"的时候,看到的将是上面的那段代码,而你真正的文件又躲过一劫。 禁示另存为 通过上面的两步好像你的源代码已经安全了,但别忘了,别人还可以将你的页面保存下来,再慢慢分析。不过别担心,下面我们来解决这个问题。 在你要保密的网页中加入以下代码: <noscript><iframe src="*.htm"></iframe></noscript> 彻底屏蔽右键方法。 <body oncontextmenu="return false"> 双击页面后自动滚屏,单击后停止。 <script language=javascript> var currentpos,timer; function initialize() { timer=setinterval("scrollwindow()",16); } function sc(){ clearinterval(timer); } function scrollwindow() {currentpos=document.body.scrolltop; window.scroll(0,++currentpos); if (currentpos != document.body.scrolltop) sc(); } document.onmousedown=sc document.ondblclick=initialize </script> 设定脚本出错能继续运行 <script language="javascript"> function killerror() { return false; } window.onerror=killerror; </script> 将彻底屏蔽鼠标右键 oncontextmenu="window.event.returnvalue=false" 可用于table <table border oncontextmenu=return(false)><td>no</table> 取消选取、防止复制 <body onselectstart="return false"> 不准粘贴 onpaste="return false" 防止复制 oncopy="return false;" oncut="return false;" ie地址栏前换成自己的图标 <link rel="shortcut icon" href="favicon.ico"> 可以在收藏夹中显示出你的图标 <link rel="bookmark" href="favicon.ico"> 关闭输入法 <input style="ime-mode:disabled"> 永远都会带着框架 <script language="javascript"><!-- if (window == top)top.location.href = "frames.htm"; //frames.htm为框架网页 // --> </script> 防止被人frame <script language=javascript><!-- if (top.location != self.location) top.location=self.location; // --> </script> 怎样通过asp的手段来检查来访者是否用了代理 <% if request.servervariables("http_x_forwarded_for")<>"" then response.write "<font color=#ff0000>您通过了代理服务器," & "真实的ip为 "&request.servervariables("http_x_forwarded_for") end if %> 取得控件的绝对位置 //javascript <script language="javascript"> function getie(e){ var t=e.offsettop; var l=e.offsetleft; while(e=e.offsetparent){ t+=e.offsettop; l+=e.offsetleft; } alert("top="+t+"nleft="+l); } </script> //vbscript <script language="vbscript"> <!-- function getie() dim t,l,a,b set a=document.all.img1 t=document.all.img1.offsettop l=document.all.img1.offsetleft while a.tagname<>"body" set a = a.offsetparent t=t+a.offsettop l=l+a.offsetleft wend msgbox "top="&t&chr(13)&"left="&l,64,"得到控件的位置" end function --> </script> 光标是停在文本框文字的最后 <script language="javascript"> function cc() { var e = event.srcelement; var r =e.createtextrange(); r.movestart(character,e.value.length); r.collapse(true); r.select(); } </script> <input type=text name=text1 value="123" onfocus="cc()"> 判断上一页的来源 asp: request.servervariables("http_referer") javascript: document.referrer 最小化、最大化、关闭窗口 <object id=hh1 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"> <param name="command" value="minimize"></object> <object id=hh2 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"> <param name="command" value="maximize"></object> <object id=hh3 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"> <param name="command" value="close"></object> <input type=button value=最小化 onclick=hh1.click()> <input type=button value=最大化 onclick=hh2.click()> <input type=button value=关闭 onclick=hh3.click()> 本例适用于ie 记录并显示网页的最后修改时间 <script language=javascript> document.write("最后更新时间: " + document.lastmodified + "") </script> 2秒后关闭当前页 <script language="javascript"> <!-- settimeout(window.close();,2000); --> </script> 2秒后载入指定网页 <head> <meta http-equiv="refresh" content="2;url=http://你的网址"> </head> 添加到收藏夹 <script language="javascript"> function bookmarkit() { window.external.addfavorite(http://你的网址,你的网站名称) } if (document.all)document.write(<a href="#" onclick="bookmarkit()">加入收藏夹</a>) </script> 禁止鼠标右键的动作 <script language = "javascript"> function click() { if (event.button==2||event.button==3) { alert(禁止鼠标右键); } document.onmousedown=click // --> </script> 或 <script language="javascript"> function click() { if (event.button==2) {alert(*^_^*); } } document.onmousedown=click // --> </script> 设置该页为首页 <body bgcolor="#ffffff" text="#000000"> <a class="chlnk" style="cursor:hand" href onclick="this.style.behavior=url(#default#homepage); this.sethomepage(你的网站名称);"><font color="000000" size="2" face="宋体">设为首页</font></a> </body> 节日倒计时 <script language="javascript"> var timedate= new date("october 1,2002"); var times="国庆节"; var now = new date(); var date = timedate.gettime() - now.gettime(); var time = math.floor(date / (1000 * 60 * 60 * 24)); if (time >= 0) document.write("现在离"+times+"还有: "+time +"天") </script> 单击按钮打印出当前页 <script language="javascript"> if (window.print) { document.write(<form> + <input type=button name=print value="打印本页" + onclick="javascript:window.print()"></form>); } </script> 单击按钮‘另存为’当前页 <input type="button" name="button" value="保存本页" onclick="document.all.button.execwb(4,1)"> <object id="button" width=0 height=0 classid="clsid:8856f961-340a-11d0-a96b-00c04fd705a2"> <embed width="0" height="0"></embed> </object> 显示系统当前日期 <script language=javascript> today=new date(); function date(){ this.length=date.arguments.length for(var i=0;i<this.length;i++) this[i+1]=date.arguments } var d=new date("星期日","星期一","星期二","星期三","星期四","星期五","星期六"); document.write( "<font color=##000000 style=font-size:9pt;font-family: 宋体> ", today.getyear(),"年",today.getmonth()+1,"月",today.getdate(),"日", d[today.getday()+1],"</font>" ); </script> 不同时间段显示不同问候语 <script language="javascript"> var text=""; day = new date( ); time = day.gethours( ); if (( time>=0) && (time < 7 )) text="夜猫子,要注意身体哦! " if (( time >= 7 ) && (time < 12)) text="今天的阳光真灿烂啊,你那个朋友呢?" if (( time >= 12) && (time < 14)) text="午休时间。您要保持睡眠哦!" if (( time >=14) && (time < 18)) text="祝您下午工作愉快! " if ((time >= 18) && (time <= 22)) text="您又来了,可别和mm聊太久哦!" if ((time >= 22) && (time < 24)) text="您应该休息了!" document.write(text) </script> 水中倒影效果 <img id="reflect" src="你自己的图片文件名" width="175" height="59"> <script language="javascript"> function f1() { setinterval("mdiv.filters.wave.phase+=10",100); } if (document.all) { document.write(<img id=mdiv src="+document.all.reflect.src+" style="filter:wave(strength=3,freq=3,phase=0,lightstrength=30) blur() flipv()">) window.onload=f1 } </script> 慢慢变大的窗口 <script language="javascript"> <!-- var windowsheight=100 var windowswidth=100 var numx=5 function openwindow(thelocation){ temploc=thelocation&, amp;, nbsp; if (!(window.resizeto&&document.all)&&!(window.resizeto&&document.getelementbyid)) { window.open(thelocation) return } windowsize=window.open("","","scrollbars") windowsize.moveto(0,0) windowsize.resizeto(100,100) tenumxt() } function tenumxt(){ if (windowsheight>=screen.availheight-3) numx=0 windowsize.resizeby(5,numx) windowsheight+=5 windowswidth+=5 if (windowswidth>=screen.width-5) { windowsize.location=temploc windowsheight=100 windowswidth=100 numx=5 return } settimeout("tenumxt()",50) } //--> </script> <a href="javascript:openwindow(http://www.)">进入</a> 鼠标指向时弹出信息框 在<body></body>之间加上如下代码: <a href onmouseover="alert(弹出信息!)">显示的链接文字</a> 随机变换背景图象(一个可以刷新心情的特效) 在<head></head>之间加上如下代码: <script language="javascript"> image = new array(4); //定义image为图片数量的数组 image [0] = tu0.gif //背景图象的路径 image [1] = tu1.gif image [2] = tu2.gif image [3] = tu3.gif image [4] = tu4.gif number = math.floor(math.random() * image.length); document.write("<body background="+image[number]+">"); </script> 鼠标一碰就给颜色看的链接 在<body></body>之间加上如下代码: <p onmousemove="anniu()">你敢碰我,我就给点颜色你看!</p> <script language = "vbscript"> sub anniu document.fgcolor=int(256*256*256*rnd) end sub </script> 从天而降并有幻影效果的窗口 <head> <script language="javascript"> function move(x) { if(self.moveby){ self.moveby (0,-800); for(i = x; i > 0; i--) { self.moveby(0,3); } for(j = 200; j > 0; j--){ //如果你认为窗口抖动厉害,就200换成个位数 self.moveby(0,j); self.moveby(j,0); self.moveby(0,-j); self.moveby(-j,0); } } } </scrip> <body bgcolor=#ffffff onload=move(280)> </body> </head> 表格的半透明显示效果 在<head></head>之间加上如下代码: <style> .alpha{filter: alpha(opacity=50)} //50表示50%的透明度 </style> 在<body></body>之间加上如下代码: <table border="1" width="100" height="62" class="alpha" bgcolor="#f2a664" > <tr> <td width="100%" height="62"> <div align="center">很酷吧!</div> </td> </tr> </table> 锁定状态栏文字防止显示地址 <body onmouseover="self.status=文字;return true"> 禁止图片下载 在<body......>这里的最后加入: oncontextmenu="return false" ondragstart="return false" onselectstart="return false" scroll="auto" 禁止缓存 <meta http-equiv="expires" content="0"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="pragma" content="no-cache"> 加在head里 使用包含页面 加密所包含页面地址,使用工具 htmlguardian5.3.5 目前功能最强的html代码加密软件,可以保护连接和html代码被盗。1.锁右键。2.禁鼠标圈选。3.不允许离线使用。4.密码保护。5.不显示状态栏url地址。6.全代码 或 局部代码保护。7.链接跟踪。8.禁止打印(ie5+)。9.压缩代码( 未加密前)。10.可加密*.html *.js *.asp *.vbs。11.两种不同加密算法。12.加密 frameset 结构。13.某些功能支持几个不同版本的浏览器。 下载flash我的三种方法: --查看源文件,找出flash的绝对路径,复制,在flashget(或蚂蚁)中点任务 ,然后点新建下载任务即可。 --在ie的临时文件夹temporary internet files里把所有的东西都删掉,然后 刷新你想要下载flash的网页,即可得到你所要的flash --使用外部软件,推荐使用flash catcher,安装后只需在你所要下载的flash上右键,save即可。 让iframe框架内的文档的背景透明 <iframe src="about:<body style=background:transparent>" allowtransparency></iframe> 进入页面后立即自动刷新? <meta http-equiv="refresh" content="120;url=http://www./cn083"> http://www./cn083,这是你自己的网址。 打开窗口即最大化 <script language="javascript"> <!-- begin self.moveto(0,0) self.resizeto(screen.availwidth,screen.availheight) // end --> </script> 能隐藏iframe的滚动条吗?我知道的三种方法: 1. 设置iframe scrolling="no" 2. 被包含页body应用overflow:hidden 3. 被包含页的body标签加scroll="no" 加入背景音乐 <bgsound src="mid/windblue[1].mid" loop="-1"> 只适用于ie <embed src="music.mid" autostart="true" loop="true" hidden="true"> 对netscape ,ie 都适用 嵌入网页 <iframe name="tt" src="01a.html" width="450" height="287" scrolling="auto" frameborder="0"></iframe> 跳转 <meta http-equiv="refresh" content="3;url=list.htm"> 滚动 <marquee direction=up height=146 onmouseout=start() onmouseover=stop() scrollamount=4> </marquee> 细线分隔线 <hr noshade size=0 color=#c0c0c0> 过度方式 <meta http-equiv="page-exit" content="revealtrans(duration=3,transition=5)"> duration的值为网页动态过渡的时间,单位为秒。 transition是过渡方式,它的值为0到23,分别对应24种过渡方式。如下表: 0 盒状收缩 1 盒状放射 2 圆形收缩 3 圆形放射 4 由下往上 5 由上往下 6 从左至右 7 从右至左 8 垂直百叶窗 9 水平百叶窗 10 水平格状百叶窗 11垂直格状百叶窗 12 随意溶解 13从左右两端向中间展开 14从中间向左右两端展开 15从上下两端向中间展开 16从中间向上下两端展开 17 从右上角向左下角展开 18 从右下角向左上角展开 19 从左上角向右下角展开 20 从左下角向右上角展开 21 水平线状展开 22 垂直线状展开 23 随机产生一种过渡方式 如何控制横向和纵向滚动条的显隐? <body style="overflow-y:hidden"> 去掉x轴 <body style="overflow-x:hidden"> 去掉y轴 <body scroll="no">不显 定义本网页关键字,可以在<head></head>中加入如下代码: <meta name="keywords" content="china,enterprise,business,net"> content 中所包含的就是关键字,你可以自行设置。 这里有个技巧,你可以重复某一个单词,这样可以提高自己网站的排行位置,如: <meta name="keywords" content="china,china,china,china"> ie5.0 的部分快捷键: a:打开查找功能:ctrl+f 关闭浏览器窗口:ctrl+w 打开地址栏下拉列表框:f4 刷 新:f5 将当前web页保存到收藏夹列表:ctrl+d 打开当前 ie 窗口的一个拷贝:ctrl+n 停止下载当前网页:esc 光标迅速移动到网页的开头:home 光标迅速移动到网页的尾部:end 打开新的地址键入窗口:ctrl+o 打开收藏夹:ctrl+i 打开历史记录文件夹:ctrl+h 打开浏览器设定的默认主页:alt+home 添加到收藏夹: <a href="javascript:window.external.addfavorite(http://链接,说明);">添加到收藏夹</a> 设为首页: <a href=# onclick=this.style.behavior=url(#default#homepage);this.sethomepage (http://链接);>设为首页</a> 定制浏览器地址栏前的小图标: a:在网页的<head></head>间加入以下语句 <link rel="shortcuticon" href="http://…/icon.ico"> 即可。其中 icon.ico 为 16x16 的图标文件, 颜色不要超过 16 色。 把滚动条放在浏览器窗口的左边 a:在 <body> 中加 dir=rtl,即 <body dir=rtl>。 让背景图不滚动 ie浏览器支持一个 body 属性 bgproperties,它可以让背景不滚动: <body background="图片文件" bgproperties="fixed"> 删除确认: <input type="button" name="del" onclick="{if(confirm(确认删除么?)){location.href=xxx.asp;}return false;}" value="on" > 隐藏状态栏中的链接地址: <script language="javascript"> kstatus(); function kstatus(){ self.status="gblog () "; settimeout("kstatus()",0); } </script>自定义指定区域的文字大小: <div id=zoom>sdrrrrrrrrrrrrrrrrrrrrrrrrrrrrr</div> 【<a href="javascript:dozoom(16)">大</a> <a href="javascript:dozoom(14)">中</a> <a href="javascript:dozoom(12)">小</a>】 <script language=javascript> function dozoom(size){ document.getelementbyid(zoom).style.fontsize=size+px } </script> input输入框文字效果: <input type="text" value="123456" style="font-size:38px;color:red;font-family:arial black">通过层来实现渐淡淡出 <script language="javascript1.2"> function makevisible(cur,which){ if (which==0) cur.filters.alpha.opacity=100 else cur.filters.alpha.opacity=50 } </script> <div style="width:200px;height:200px;filter:alpha(opacity=50);border:1px solid #000;background:#efefef" onmouseover="makevisible(this,0)" onmouseout="makevisible(this,1)"> ywicc.com </div> 网页屏保 <script language="javascript"> function screensave(){ test.value++; if(test.value==5){ test.style.display=none; document.all[4].bgcolor=black; } } function screenopen(){ test.value=0; test.style.display=; document.all[4].bgcolor=; } </script> <body onkeydown="screenopen()" onmousemove="screenopen()" onload="setinterval(screensave(),1000)"> 5 秒屏保<input id="test"> 让标题动态 <script> <!-- var tx = new array ( "◇:::::::网页制作学习园地:::::::◇欢迎您!◇", "◆欢迎大家光临网页制作学习园地网站!◆", "◆大量供应网页制作教材,资料,源代码,网页制作软件,相关插件光盘!◆", "◆最可怕的敌人,就是没有坚强的信念!◆", "◆应该让别人的生活因为有了你的生存而更加美好!◆" ); var txcount=5; var i=1; var wo=0; var ud=1; function animatetitle() { window.document.title=tx[wo].substr(0, i)+"_"; if (ud==0) i--; if (ud==1) i++; if (i==-1) {ud=1;i=0;wo++;wo=wo%txcount;} if (i==tx[wo].length+10) {ud=0;i=tx[wo].length;} // if (window.document.title.length < 20 ) window.document.title=window.document.title+"-"; // if (window.document.title.length == 20 ) window.document.title=window.document.title+"]"; // if (window.document.title.length == 21 ) settimeout("window.document.title=animierte seitentitel ; ",1000); parent.window.document.title=tx[wo].substr(0, i)+"_"; settimeout("animatetitle()",100); } animatetitle(); // --></script><script language="javascript"> <!-- function mm_openbrwindow(theurl,winname,features) { //v2.0 window.open(theurl,winname,features); } //--> </script> 隐去浏览器中当鼠标移到图片上跳出的工具栏 <img galleryimg="no"> 或者 <head> <meta http-equiv="imagetoolbar" content="no"> </head> 在form中只有input输入框的情况下...在这个input输入框中按enter进行提交表单 <form onsubmit="if(event.srcelement.name==bb){this.submit()}else{return false}"> <input name=a size=20> <input type=button name=bb onclick="submit();"> </form> 删除确认 <input type="button" value="删除" onclick="{if(confirm(确认删除么?)){location.href=aa.asp;}return false;}">或 <a href="aa.asp" onclick="{if(confirm(确定删除吗?)){return true;}return false;}">删除</a> 或 <a href="del.asp" onclick="return confirm(该删除操作将无法恢复!是否继续?)">删除</a> 返回页面顶部: javascript:window.scroll(0,0) 离开页面时弹出警告: <body onbeforeunload="checkclose()"> <script> function checkclose(){ event.returnvalue = "测试啊" //xxx可以改为任何文本信息也可以是空 } </script> <a href="a.asp">aa</a> |
|