TA的每日心情 | 衰 2019-8-18 09:37 |
---|
签到天数: 2 天 [LV.1]初来乍到
|
点击返回上页代码:
* |' Z; ~' c. R n) V( ~) d<form> * z- A8 {/ a S! t( z* [
<p><input TYPE="button" VALUE="返回上一步"></p>
, f4 ?* _/ h4 m4 c8 r: I0 \</form> % |9 S7 d, X4 y9 w; c8 U
. _3 J, @4 [3 |' c: b弹出警告框代码:
: U$ v3 V' m( O8 D<form>
2 v+ y: Y! M4 C3 d6 W9 u" Y<p><input TYPE="button" VALUE="弹出警告框"></p>
0 e8 d$ q# c D/ ~, k/ V</form> 4 b. G& _" z6 |" v! H0 r
<script language="JavaScript"><!-- ( `0 E$ z2 M5 T9 k0 [7 n
function AlertButton(){window.alert("要多多光临呀!");} 4 a" I& I+ q4 _, v, Q. s" x: T, ]0 i
// --></script>
+ U& A9 a2 Q# T2 A$ x. l5 ]# d' \3 Q$ f* O9 g
点击打开新窗口 8 S; l! ~8 |2 [
<form> ) P H, q \; C' P. j( ?2 c7 J
<p><input TYPE="button" VALUE="打开新窗口"></p>
7 D% C1 Z+ D9 @</form>
$ d! g0 }" j" v* b8 b<script language="JavaScript"><!--
: _# y+ a( Z# g* M/ D5 a( w {- cfunction NewWindow(){window.open("http://www.mcmx.com","","height=240,width=340,status=no,location=no,
( L8 S6 ~3 c; i6 utoolbar=no,directories=no,menubar=no");} 6 L0 g+ q6 G- S6 [9 j7 a7 `6 Y
// --></script></body> $ G2 f# o8 v) T5 H1 y8 f$ y
" o# E/ }4 {6 g% H. S* O4 F* t B
删除记录时弹出确认框:
, {! Z* O: d+ s0 G. F# P- @% a9 k<script LANGUAGE="VBSCRIPT"> - T8 ~6 V) j* ?9 U( j5 C2 d; L$ k
a=msgbox("真的要删除该记录吗?",1,"注意")
1 }" T& Z B0 T( }4 yif a=1 then - e# P: l7 U' i+ k. k* Y, W- ?* |
location="Dodelete.asp?id=" //指向执行删除的页面Dodelete.asp ) l2 h& D, D4 [
else
" X; t: x T7 X# Jhistory.go(-1)
3 e5 t5 b) Y! Y. d' I, P6 i7 rend if
+ U' M+ e+ Y' H</script> 5 @4 m- S. c, r* J
8 Y$ X& a0 u" E- ~关闭打开的窗口
1 B$ b) q0 k. {2 i< a href="/">关闭窗口</a> # ^0 i+ W( |: q. u6 S4 d4 X3 C
* j9 M8 l+ K1 W4 y- C. V, d2 f7 r# ?
清空INPUT且选定 9 S: ^. X% F5 X; Z% J
onClick="Javascript:this.value=''"
- R9 v/ A/ v! c. D4 X- n/ H1 {+ d% k! }- T
右键屏蔽
" b/ L7 D0 ~% f. {& B( e) h7 N0 H/ L<body oncontextmenu=self.event.returnValue=false>
2 j, W; {8 X: k1 Y( J/ {+ Y7 a6 {5 f+ S- P0 O
连串英文自动换行的解决方法 IE5.5 0 {0 B0 k" G, R) d7 L5 H4 m) Q
style="LEFT: 0px; WIDTH: 100%; WORD-WRAP: break-word" 你可修改为指定的大小如 200px - p% y! z7 x4 M) u9 A' ~
4 Y6 N" ]% U& Z/ c2 c图片“重置”按钮 . ^% Q3 c$ J# L- M' ]( B' P
<script language="jscript"> C% F+ L7 h9 j7 V
function myreset() x4 `4 B3 m$ P0 e6 f; ]
{ document.login.reset(); * _- i. |5 y3 Q. f- G
document.login.focus();} + B E, {2 O2 H5 M9 h
</script> 9 A4 ^: P4 K/ e( c% `# Y# o; Q
<img src="image/reclear.gif" width="69" height="20" style="cursor:hand" 1 m% C' _: B8 P+ h
8 u8 q" Q" N9 W, P+ V$ h' F
画细线表格 / c2 D% |8 X8 E
<table style="border-collapse: collapse">
- w5 p; H+ y$ T) j3 p$ ~- }3 A1 N, T6 H3 `7 M4 r% [
状态栏信息
2 F. ~& F: W) H* S, V<form>
( `* D" V7 ~% c<p><input TYPE="button" VALUE="状态栏信息"></p> ' W2 I" i c6 Q. m3 R' w( h
</form>
- I) H- h6 z# t<script language="JavaScript"><!-- $ V' b6 h, I, B ^0 y: H" Q0 T( t% k
function StatusButton(){window.status="要多多光临呀!";}
9 b& d0 v# R" j6 ?// --></script> , C, f* _1 y2 g) y, ~' q. x; F g
; ?& N0 _! A. J
最小化、最大化、关闭窗口 9 \( ~% n( ^; Z* c1 A+ y
<object id=hh1 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"> 4 M/ a3 i6 X5 Q4 r$ l* [2 L# |2 N8 m
<param name="Command" value="Minimize"></object> y0 h, U. Q4 S
<object id=hh2 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"> ; n! N, e8 l6 {! @$ y4 o- z' ~
<param name="Command" value="Maximize"></object>
: \6 B8 X* ^ k9 Z4 f& ~8 [<OBJECT id=hh3 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"> 2 ]$ [ j( h1 M8 ~: P
<PARAM NAME="Command" VALUE="Close"></OBJECT> 4 b+ M. E l$ G: A
' o5 {1 o7 q: ?5 ]' L4 o7 Q% c
<input type=button value=最小化 onclick=hh1.Click()>
/ S# m) e0 b: t% L<input type=button value=最大化 onclick=hh2.Click()>
6 P6 N. G- l+ J. t1 ~<input type=button value=关闭 onclick=hh3.Click()> 6 H* z" b ]' [3 ~7 Q3 u
本例适用于IE # @: K4 f+ Q; t3 {/ Z* I B. e
' ~! R$ \0 T: y. @" Y& j/ ^
隐藏状态栏里出现的LINK信息
- M' a+ G4 u' Y5 S8 @<a href="http://";>梦想天空</a> ) \: n9 J+ ?, `6 x
. H' H& w- f4 P0 R5 Z. F
文本框自动滚动条 9 o! D! E+ C! U N- k* ^
<textarea name=words rows=18 cols=26 style="border:1 solid #000000;background-color:white; font-size:9pt; width:188; overflow:auto" wrap=hard></textarea>
0 d2 J5 c/ f" C" v* d) V& T9 R: e5 ^& L0 q( F6 q
全选并复制
9 I, y# t+ ? K# f8 H; I<FORM name=test><INPUT type=button value=全选并复制><BR><TEXTAREA name=select1 rows=3 cols=46>你好,欢迎您的光临!</TEXTAREA>
9 V& v5 \+ n9 g! m9 @6 X6 B3 q* `</FORM>
4 F4 l/ z- @" o. W. U- K+ `<SCRIPT language=Javascript> 7 z( ~2 n! W1 y6 Z
<!-- 2 i8 _0 b1 d+ h0 C
( p$ v1 M+ v& P5 K& |4 qvar copytoclip=1
+ j5 I2 Y3 k' X( f% k/ K7 T0 c+ {
function HighlightAll(theField) { # L) q# C, `( i3 I: R0 g5 B T1 V- T
var tempval=eval("document."+theField) ' d$ q* W; z0 N% r- f
tempval.focus() 1 V- {1 \; ?# J2 Y; o
tempval.select()
6 X2 m( R1 O2 H6 E9 Q: nif (document.all&©toclip==1){ ( Z( o2 u& j0 Q) r4 B
therange=tempval.createTextRange()
3 Y; Y$ V" ^3 U% t2 B$ [therange.execCommand("Copy")
1 A3 a! R/ D! Vwindow.status="Contents highlighted and copied to clipboard!"
8 F9 H- a, j0 Q k& y- s+ FsetTimeout("window.status=''",1800)
& u% u' D2 t% r1 l. L}
: i7 O0 [% ]1 ~8 F} 8 O8 L, b( p( r# ~6 l
//-->
4 N4 \# F A/ h, z</SCRIPT> 0 b2 `4 t7 |7 L9 J8 C E( q: \
" ^4 Q& I# \9 O4 c/ `+ ?2 d
屏蔽JAVASCRIPT错误
, W! v& Z: W; b. b<script language="JavaScript"> ; K$ R7 i X* Y/ j
<!-- # w6 p W& C9 _: J
function killErrors(){ 1 p1 u* d* H$ R
return true;
* z5 K: k" [/ c- I} 9 a1 S) F. I V1 T% S
window.onerror = killErrors; 7 a. C4 ^: b- D- v
--> 1 }4 z4 i) F$ }6 J6 Q3 `* y
</script> 9 J6 f9 S2 S( O+ H) Q
7 F) X; C& a5 u3 R3 ^' I
关闭子窗口时刷新父窗口
1 Y3 n/ z& T1 u$ ~<script language="JavaScript"> ( R6 C: G4 F4 D x" ~% g
<!--
5 [0 {8 g' R% P R6 N& _self.opener.location.reload(); 3 T/ C9 ]1 @3 ]& f. M6 h" e
window.close() , h# N0 \5 [2 v% K& h5 a# u+ G% ~
-->
% ^/ B' h% l0 J$ r% X; k/ E</script>
& q# I) g4 u7 m' [% {. S" m2 ^% ?" k
# G0 t E' x% `( j- u @' h. p
背景色变换
: G# S @% z9 W) l6 r2 n+ ~<form>
! [* x# u3 h! Z0 v9 c<p><input TYPE="button" VALUE="背景色变换"></p>
: [! F y& i; t7 B8 t9 a* p</form> ; G0 a/ m; b8 B2 `
<script>function BgButton(){ ' M$ J. V7 B. x1 C; J1 v! w6 z9 ]
if (document.bgColor=='#00ffff') 5 B4 K6 u( G/ ^2 Y
{document.bgColor='#ffffff';} ; j) p! `& x+ m. R) X6 d$ j
else{document.bgColor='#00ffff';}
. V$ T! K, g# Z8 C. r8 x1 ^( S0 c}
~: m; m. M p" b</script>
' J F& o# P$ j% l$ Z. J8 I0 Y1 O) M" p) ]# B0 b
检查一段字符串是否全由数字组成 % s5 \$ [3 W+ d- E' t' ^' f4 S
<script language="Javascript"><!--
' M( ~. Y \3 o* ]4 jfunction checkNum(str){return str.match(//D/)==null} 1 `* d( _0 C @% F: ]$ G% R/ m
alert(checkNum("1232142141"))
2 \1 x( r. U% K( P2 p. palert(checkNum("123214214a1"))
, \7 o, i: o$ C! b- }( I3 Z// --></script>
8 M9 d4 R0 ^3 ]8 u( j) G3 ] j' `
1 H3 O2 L2 x4 o判断是否是字符 - B/ F4 B8 s4 p) ?% o+ n1 k
if (/[^/x00-/xff]/g.test(s)) alert("含有汉字"); # V' L) z( ]# N# F5 H( |' V
. [& `3 C& t2 [点击刷新代码:
5 y9 \6 @: G/ I" f' y8 B( ?. J<form>
" U! N: b1 M. \, n2 Z<p><input TYPE="button" VALUE="刷新按钮一"></p>
( g" I) H F- X9 N! n k$ M</form>
: p5 m- N+ M6 S& U<script language="JavaScript"><!-- . @# j, @+ A* h6 ^5 t, Q5 M
function ReloadButton(){location.href="allbutton.htm";}
6 q$ A; r% p* D3 z9 P// --></script>
. C7 X# g6 K! f7 f' D5 ~4 e3 ^4 c1 Z, J# D2 n6 \0 v
让层不被控件复盖代码:
( \. |% h, \6 y* P1 q" L u<div z-Index:2><object xxx></object></div> # 前面
. ^" [3 L7 F/ E7 R. J O1 J<div z-Index:1><object xxx></object></div> # 后面 , A v/ r* A" r3 u0 y
<div id="Layer2" style="position:absolute; top:40;width:400px; height:95px;z-index:2"><table height=100% width=100% bgcolor="#ff0000"><tr><td height=100% width=100%></td></tr></table><iframe width=0 height=0></iframe></div> 2 o. |/ |3 J- O/ b& N
<div id="Layer1" style="position:absolute; top:50;width:200px; height:115px;z-index:1"><iframe height=100% width=100%></iframe></div>
5 d w( i q8 W8 @
" y5 f! D) O% O; N- k G2 W" l6 \让层的相对定位
/ L& n6 [& N/ Y$ ?# E! I5 }% W<div id="Layer1" style="position:relative; left:0px; top:0px; width:0px; height:0px;z-index:1">
* L2 i4 k! N- q; }* K L/ Y<div id="Layer2" style="position:absolute; left:500px; top:0px; width:220px; height:220px; z-index:1">
& w) |3 B( I4 A: V( T6 V% h内容 m) _& N% O! l4 z+ Z' {0 N5 c
</div></div> 4 _: `/ K4 y- A. ?9 o2 P. S
0 [9 U/ E: J8 I: p; S \5 h
Flash代码以及背景透明 ( F, Y+ ^7 p( V, @0 J" h- ^
<object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="200" height="200">
. j2 W$ N4 k) _! n9 ]& Y" q; q<param name="movie" value="文件"> 8 E8 D* s% j8 a1 o% H& A8 W- X
<param name="quality" value="high">
+ @+ `" V2 G% d2 g+ `6 t<param name="wmode" value="transparent">
( |/ h0 c; g8 j4 Y O<embed src="images/fish.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="220" height="220"></embed></object> |
|