找回密码
 立即加入
搜索

查看: 1241|回复: 3

一些网页中常用的精华代码

[复制链接]
鹭岛の御风 发表于 2005-10-15 04:56:56 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转闽南师范大学。

您需要 登录 才可以下载或查看,没有账号?立即加入

×
一些网页中常用的精华代码 + W+ f) l1 h/ L
, u% L  d4 `% v# w" ?7 W
<% response.write "
1 n2 x& \$ m2 s% f1 m" u* R3 L" p1.oncontextmenu="window.event.returnvalue=false"将彻底屏蔽鼠标右键5 j2 p6 h1 f/ C/ q
<tableborderoncontextmenu=return(false)><td>no</table>可用于table
5 n3 w4 I) g, t. Y( }2.<bodyonselectstart="returnfalse">取消选取、防止复制
+ V  P7 t* V! l( b3.onpaste="returnfalse"不准粘贴
; k4 w1 l0 ^' Z5 Y6 {4.oncopy="returnfalse;"oncut="returnfalse;"防止复制6 D; J& r7 d6 J0 m1 a$ |8 C
5.<linkrel="shortcuticon"href="favicon.ico">ie地址栏前换成自己的图标, u$ a. [# H9 ~  X+ z
6.<linkrel="bookmark"href="favicon.ico">可以在收藏夹中显示出你的图标
& H! l) h# n9 _" e9 k7.<inputstyle="ime-mode:disabled">关闭输入法6 E( P* w; \- \1 S
8.永远都会带着框架& I1 t0 |$ q6 J# D$ C* H& S0 G
  1. &lt;scriptlanguage="javascript"&gt;<br><!--, ]8 E: K" P' S! y. d
  2. if(window==top)top.location.href="frames.htm";//frames.htm为框架网页8 V/ U0 C3 p1 k* x# {
  3. //--></script>
    : ~6 o5 o2 I' \# z
  4. 9.防止被人frame. T; m4 P' O2 @1 j9 C; k9 n) y
  5. <scriptlanguage=javascript><!--
    ' h$ n8 }6 {' D! `! A
  6. if(top.location!=self.location)top.location=self.location;9 F- p" z  B8 S2 `
  7. //--></script>
    1 `  `7 v  i6 q$ t0 _6 }9 U+ V; d
  8. 10.<noscript></noscript>网页将不能被另存为
    * j6 w0 t- A" a/ J2 g$ @4 y. n
  9. 11.<inputtype=buttonvalue=查看网页源代码>http://www.csdn.net/";;;;;>
    8 Z5 ~  a  [, m9 N: F
  10. 12.怎样通过asp的手段来检查来访者是否用了代理2 }/ I# s. @8 l
  11. <%ifrequest.servervariables("http_x_forwarded_for")<>""then
    " k2 d, u' k1 x. [
  12. response.write"<fontcolor=#ff0000>您通过了代理服务器,"&_
    3 U7 B( z+ d* Y+ ~
  13. "真实的ip为"&request.servervariables("http_x_forwarded_for")+ v! ]( e  l7 s( W
  14. endif8 K' j: \9 o0 X
  15. "%>4 _, {% O- [3 j" y/ x5 ^9 U; a
  16.     <% response.write"
    ' y6 U- Y3 B% e7 z6 L6 ]
  17. 13.取得控件的绝对位置
    , \: m1 `7 _9 H4 r5 L+ Z
  18. //javascript
      p% l. q: p, c8 S8 N) Q4 W) A
  19. <scriptlanguage="javascript">
    5 l6 E  V; o# w1 t$ ~& j; Q# o% q
  20. functiongetie(e){
    5 ^3 I6 l2 M0 E& @2 i2 Z) e
  21. vart=e.offsettop;
    $ r) {) o5 X. c* a: ^4 |1 R
  22. varl=e.offsetleft;
    7 R5 v  _2 t1 j: S  G# n  ~
  23. while(e=e.offsetparent){. Q& \6 W3 F: E0 a7 H
  24. t+=e.offsettop;
    , |5 N9 ~& _+ }  V) V! ?4 X$ \7 Y
  25. l+=e.offsetleft;! \) E0 C) g  M4 b8 W( q
  26. }) o$ z! Y- i4 S8 t% o3 p
  27. alert("top="+t+"\nleft="+l);4 K6 @! _2 P6 O8 f0 ~! ]
  28. }6 Q- W9 L$ }3 L7 m
  29. </script>0 O* F+ J  q9 Y7 O( v! z
  30. //vbscript
    2 r, R7 o* g' \: k
  31. <scriptlanguage="vbscript"><!--2 z5 [* {8 X% `  Y5 C6 Q6 U; X4 N
  32. functiongetie()
    0 U/ p' X) p  m/ L
  33. dimt,l,a,b
    5 u! }* c1 H# m" C
  34. seta=document.all.img1
    ; n6 r7 G' b! D4 ^. X
  35. t=document.all.img1.offsettop
    * O; V0 e, N4 T
  36. l=document.all.img1.offsetleft0 o3 A! ], z' f2 }' ?
  37. whilea.tagname<>"body", o8 P/ y) m4 E" V# G9 A0 I
  38. seta=a.offsetparent3 t/ Y9 s  |) G* J  A
  39. t=t+a.offsettop
    $ L! M$ q  Q" n# l2 u
  40. l=l+a.offsetleft
    3 [1 g3 L" p) g4 a' r6 t: c' ~5 M
  41. wend+ U3 x( k6 t3 G
  42. msgbox"top="&t&chr(13)&"left="&l,64,"得到控件的位置"
    # D# [4 x, V0 u* b, X, l
  43. endfunction9 u# W! q: @5 o0 C+ y
  44. --></script>
    ; [" z7 ]* c( N3 s' q0 ^
  45. 14.光标是停在文本框文字的最后: {8 e" n( Z3 m% j$ k) X
  46. <scriptlanguage="javascript">
    # C; J* O! x6 ]
  47. functioncc()
    1 S' l, _7 E! G- g
  48. {2 I" I' |  D3 \' g
  49. vare=event.srcelement;) \5 ~* L' Q2 f/ r) W- a: r& [
  50. varr=e.createtextrange();
    + i# @- ]: w' T, B
  51. r.movestart(character,e.value.length);0 _0 h' a9 _& d
  52. r.collapse(true);+ u; g+ ]* e6 D7 `4 g7 `
  53. r.select();
    + A5 t" Q. W6 S# V( i# w! d/ O0 r
  54. }
    " C' {; b4 [* H
  55. </script>
    5 i9 I) ~% k7 }
  56. <inputtype=textname=text1value="123">
    # \) s7 O' r0 Y3 ~9 z" _  K
  57. 15.判断上一页的来源
    3 F0 `& T* X% \8 Q1 v! X, \
  58. asp:* p0 k; U2 o) p. l
  59. request.servervariables("http_referer")* |7 t* Q1 W9 X
  60. java script:
    7 p, W) `- i$ L( {2 E
  61. document.referrer$ k6 j* I5 o8 u% L8 g9 _/ u9 Z
  62. 16.最小化、最大化、关闭窗口
    5 ~8 h! R2 H+ e7 ^3 \, f+ P  q3 ~# d
  63. <objectid=hh1classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">  q; b- y0 B3 h: X! p9 Y
  64. <paramname="command"value="minimize"></object># W3 F8 z, Q9 K$ e1 E. p+ l( R3 i9 |
  65. <objectid=hh2classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
    : u7 v; W# c, A6 ]
  66. <paramname="command"value="maximize"></object>
    # f' U. U5 g2 w
  67. <objectid=hh3classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">) i6 q3 o7 U3 t- u2 I8 M
  68. <paramname="command"value="close"></object>' M- S. W, c& X4 m% g5 o8 C/ F1 c
  69. <inputtype=buttonvalue=最小化>
    0 i1 E- @7 v3 R4 W& l8 p- h
  70. <inputtype=buttonvalue=最大化>+ H7 D2 ~6 O3 S* `9 X, O
  71. <inputtype=buttonvalue=关闭>
    / v8 |, [( r6 s
  72. 本例适用于ie
    ( r4 }% M  Y( o: v( ]
  73. 17.. d6 X9 V" g7 J7 ?
  74. <%
    . Q6 m9 C# y& Z- t' s7 T. s
  75. 定义数据库连接的一些常量
    % o' B2 t0 k0 F5 s* N: d* @/ ?
  76. constadopenforwardonly=0游标只向前浏览记录,不支持分页、recordset、bookmark! D! }/ o( E! I' W& C$ h+ ^
  77. constadopenkeyset=1键集游标,其他用户对记录说做的修改将反映到记录集中,但其他用户增加或删除记录不会反映到记录集中。支持分页
    4 X7 z2 _$ Q. Y% C7 x% _
  78. 、recordset、bookmark% E/ S0 p3 u+ X3 T7 a
  79. constadopendynamic=2动态游标功能最强,但耗资源也最多。用户对记录说做的修改,增加或删除记录都将反映到记录集中。支持全功能浏
    # u! q0 b8 ^3 l+ j. `7 q) p
  80. 览(access不支持)。
    9 |7 ]3 }' R; g1 Q1 n
  81. constadopenstatic=3静态游标,只是数据的一个快照,用户对记录说做的修改,增加或删除记录都不会反映到记录集中。支持向前或向后移. F, o* m9 {: R% }
  82.   ?. M- j- w. k* K5 |  N/ |9 g. D
  83. constadlockreadonly=1锁定类型,默认的,只读,不能作任何修改, G% ^- ^1 `6 B$ b: s6 H' x
  84. constadlockpessimistic=2当编辑时立即锁定记录,最安全的方式
    3 f( Q4 N' R* j
  85. constadlockoptimistic=3只有在调用update方法时才锁定记录集,而在此前的其他操作仍可对当前记录进行更改、插入和删除等
    ) r' `# `: p# r# M5 ]  N  O3 l
  86. constadlockbatchoptimistic=4当编辑时记录不会被锁定,而更改、插入和删除是在批处理方式下完成的  @& [9 @6 k' A: y' M3 K2 t* v
  87. constadcmdtext=&h0001
    ( B# e2 N( u8 m, t
  88. constadcmdtable=&h0002
    " l1 S( `8 d0 k# K5 ^. R
  89. " %>
    9 z! _/ e% ?: ?$ m) o0 f
  90. 18.网页不会被缓存
    $ F6 a5 F2 r( I9 q
  91. htm网页
    # [5 N8 y! y- C6 O, v
  92. + T5 {6 _. M6 k( V7 A( D
  93. 7 u6 S7 r2 z6 m" k; \: H  L

  94. * J. s/ T' H$ s6 |" m
  95. 或者+ i  Y6 ^6 D4 \
  96. asp网页
    4 J( w% v  H# g6 _) o
  97. response.expires=-1
    / T9 y% ?6 \5 o; [( N  f# t
  98. response.expiresabsolute=now()-1
    # |% E4 ~8 L* n8 m% o" W2 o
  99. response.cachecontrol="no-cache"
    & [% Y3 O0 d" P( a! q, T  A
  100. php网页( y. p1 q1 o/ w1 G0 r& Z, G) E
  101. header("expires:mon,26jul199705:00:00gmt");$ R: i) `4 U: r
  102. header("cache-control:no-cache,must-revalidate");0 h! k3 @1 b6 c5 M0 J/ F# C
  103. header("pragma:no-cache");9 J1 V3 d: d2 S6 E% Z
  104. ! X6 V1 x( h, i2 z* t/ \+ p
  105. 19.检查一段字符串是否全由数字组成) P1 r* \3 B" C# f' L2 |8 v
  106. <scriptlanguage="javascript"><!--2 j2 |4 ?1 s) D/ ?% V9 b
  107. functionchecknum(str){returnstr.match(/\d/)==null}
    6 g) e' }4 G8 r1 n
  108. alert(checknum("1232142141"))
    * A" F+ }; V+ e9 Q+ l' k& l
  109. alert(checknum("123214214a1"))
    ( @  F: @4 r& y1 h4 k6 o! @8 W
  110. //--></script>
    6 H; |0 o5 e6 o, b% ^' R. z
  111. 20.获得一个窗口的大小
    4 |$ a, o* b9 H1 [
  112. document.body.clientwidth,document.body.clientheight4 @& _8 f# _4 A' E' f9 r9 `
  113. 21.怎么判断是否是字符: Z& D2 W+ @  \' i: G
  114. if(/[^\x00-\xff]/g.test(s))alert("含有汉字");
    - G* {' e) j' ]' \
  115. elsealert("全是字符");
    ; G5 d" N0 S& I" P5 v7 y
  116. 22.textarea自适应文字行数的多少, N+ a# j5 k2 L  C
  117. <textarearows=1>
    ' o1 E$ m) I! q( ^7 E  c( q
  118. </textarea>
    0 C9 W# C7 R/ q7 W8 X
  119. 23.日期减去天数等于第二个日期. l" w; R) f& |, ?" [
  120. <scriptlanguage=javascript>
    6 v0 H) M; \) Z
  121. functioncc(dd,dadd)0 M" M4 J* m7 |2 @' k
  122. {& C) r6 t2 _$ m, z* K/ Y
  123. //可以加上错误处理: m0 ~1 m, s2 K
  124. vara=newdate(dd)
    4 @+ ?# ]* I; p
  125. a=a.valueof()
    % T: _  x# C- q  V0 C, ~% e
  126. a=a-dadd*24*60*60*1000! F2 [2 X. b! z+ A5 h3 G
  127. a=newdate(a)
    9 f  d( p" x: P7 l, Z2 Y% C; t: }
  128. alert(a.getfullyear()+"年"+(a.getmonth()+1)+"月"+a.getdate()+"日")
    8 C0 g3 o; @0 V
  129. }
    ! G! ]3 b+ T  M8 p
  130. cc("12/23/2002",2)
    ( y' _- R$ P. c* q
  131. </script>3 t$ K9 j, Z8 v9 q! _# ]% l
  132. 24.选择了哪一个radio) R4 a7 i: Q1 m5 u# v
  133. <html><scriptlanguage="vbscript">- W  @' ]4 T4 [- a+ I. l
  134. functioncheckme()
    ( y8 M  U1 q/ d: Y( R! g4 l
  135. foreachobinradio1! Y5 \- \/ R  u0 y
  136. ifob.checkedthenwindow.alertob.value
    $ i  e3 C2 R, s9 e3 {2 e% ^
  137. next; g2 b7 q" j) R; [3 u' `1 _1 g
  138. endfunction
    8 L" v% z5 w  F2 j' E
  139. </script><body>
    / T# G0 b* M. P; n6 e9 u: H# o, c' i
  140. <input>style
    8 h4 V, x' m+ |! b, V1 G5 X7 I  {
  141. <input>barcode" E. k/ Z2 x8 k6 D/ s
  142. <input>' h& d7 b" T* `& c( u; H: e; g
  143. </body></html>
    8 b/ E3 v( j, `! O: C5 f
  144. 25.获得本页url的request.servervariables("")集合! V- ~* d; L+ D1 l& X4 |  u
  145. response.write"<tableborder=1><!--tableheader--><tr><td><b>variables</b></td><td><b>value</b></td></tr>"1 a$ _9 M* x& v6 M2 h7 I" G
  146. foreachobinrequest.servervariables# M/ R0 P: D7 N2 ?; W. J, r
  147. response.write"<tr><td>"&ob&"</td><td>"&request.servervariables(ob)&"</td></tr>"
    ' M1 B2 ^* R; |5 a0 g! `9 W
  148. next" |! R, Y$ ]8 F0 E, r
  149. response.write"</table>") m0 W, ?! O) B! h
  150. 26.
    % ?6 e2 o: y* C( O- z  {5 B4 e* o
  151. 本机ip<%=request.servervariables("remote_addr")%>
    9 y# Z% k$ d& T4 x. g0 d
  152. 服务器名<%=request.servervariables("server_name")%>
    1 ~8 p2 ~. ]; a& t+ M  ~/ b5 w
  153. 服务器ip<%=request.servervariables("local_addr")%>
    5 L# C- h8 |9 y% M6 U
  154. 服务器端口<%=request.servervariables("server_port")%>
    0 a, [' H% p' W. D( q
  155. 服务器时间<%=now%>
    8 i) g4 e3 D* m( m9 n. m
  156. iis版本<%=request.servervariables"server_software")%>
    $ M( x7 }/ B+ e- y  C9 J1 V! @( v
  157. 脚本超时时间<%=server.scripttimeout%>
    4 y! D/ X6 I5 N/ k# I+ k
  158. 本文件路径<%=server.mappath(request.servervariables("script_name"))%>: g0 E0 S: d8 N) p
  159. 服务器cpu数量<%=request.servervariables("number_of_processors")%>
    ! {# t! M1 t' [# C
  160. 服务器解译引擎<%=scriptengine&"/" & scriptenginemajorversion &"." & scriptengineminorversion & "." &
    : n# B1 K1 O" ~2 `! l' ]0 U3 k
  161. scriptenginebuildversion%>1 H6 e# O3 a% C5 }
  162. 服务器操作系统<%=request.servervariables("os")%>0 z2 b1 j5 T& V6 k8 z( z; _
  163. 27.enter键可以让光标移到下一个输入框' E9 d# ?" p' r! k4 P
  164. <input>+ Q6 O; O6 s/ u
  165. 28.检测某个网站的链接速度:
      }" C' o' C$ p, y6 ^: D
  166. 把如下代码加入<body>区域中:
    4 u$ O  ?" `5 `8 W5 f
  167. <scriptlanguage=javascript>
    , Q5 u6 j6 u0 n5 \4 w
  168. tim=1
    ; U9 u+ ~! g# F( ?; ~9 N9 ^
  169. setinterval("tim++",100): L: K( f0 r7 |: \! o
  170. b=1+ d6 U1 x* \3 o5 g% C
  171. varautourl=newarray()
    . b$ x# F8 a$ p& J) a# m. a- B
  172. autourl[1]="< src="pic/url.gif" align=absmiddle border=0>www.njcatv.net"- z6 T+ y+ g, ]0 i0 @
  173. autourl[2]="javacool.3322.net"
    " t" [7 o2 h- z6 T3 W
  174. autourl[3]="< src="pic/url.gif" align=absmiddle border=0>www.sina.com.cn"
    2 B# B% p( @; d6 j
  175. autourl[4]="www.nuaa.edu.cn"
    # e- f, w  q5 U- k, d5 {
  176. autourl[5]="< src="pic/url.gif" align=absmiddle border=0>www.cctv.com"# w9 ]+ B7 Z) T  X& w) x2 ?
  177. functionbutt(){8 |% S! h; |+ N! t0 x
  178. document.write("<formname=autof>")
    . Q! u5 S4 ~: |
  179. for(vari=1;i<autourl.length;i++)>=》<inputtype=textname=url"+i+"size=40>=》+ F/ o, m6 s# F
  180. <inputtype=buttonvalue=go><br/>")! ^$ g7 M- k. E; `. Q/ H5 h
  181. document.write("<inputtype=submitvalue=刷新></form>")# Z" P0 ~& T& i1 g* W* F
  182. }: z0 N( ~  x- X) o
  183. butt()# f2 j, H% m9 Y4 |
  184. functionauto(url){
    ; }& E6 L, }- [% P% Q
  185. document.forms[0]["url"+b].value=url6 Q; G. e3 `, c/ n* @+ N' P" V& R
  186. if(tim>200)2 @( C% `  N1 V% n1 X
  187. {document.forms[0]["txt"+b].value="链接超时"}5 n1 J3 Q* N8 b7 O
  188. else
    % g, H6 d/ D& p- h* M& \
  189. {document.forms[0]["txt"+b].value="时间"+tim/10+"秒"}
    ) Z5 e8 j, A% I1 B3 I
  190. b++
    8 j$ G: E0 u: _4 S( d* {  S
  191. }
    ; b; p' B3 Z& v. k0 f# U% l
  192. functionrun(){for(vari=1;i<autourl.length;i++)>http://";;;;;;+autourl+")>")}
    5 y: h* }0 e& k) |% N6 Q, h
  193. run()</script>: \0 Q5 v3 c0 Z0 q3 G

  194. ' g- a' A. o, L/ z7 ^/ T/ K2 P  B: S6 _
  195. 29.各种样式的光标3 _! d4 d" \$ V, A7 k8 R
  196. auto:标准光标
    & B+ C# |- c; q4 L3 a6 Q
  197. default:标准箭头
    2 l; s% E% w$ V% _
  198. hand:手形光标
    2 _" M( I0 [. \! m
  199. wait:等待光标
    4 F% \: F" l2 [- o3 X! c( B  f9 w+ m
  200. text:i形光标' {9 J# x9 @1 S
  201. vertical-text:水平i形光标
    ( j- n) c, ^* L+ [
  202. no-drop:不可拖动光标# L/ ?9 y! @; v/ k& s8 f* Y
  203. not-allowed:无效光标! v) F8 X+ g& ^
  204. help:?帮助光标0 m9 X! \, q; Z' \* h0 A& E. J# K1 c
  205. all-scroll:三角方向标/ p4 F9 C( C0 H. j8 Y/ K
  206. move:移动标
    * U9 ^1 |: X* e: O) d, e
  207. crosshair:十字标
    + s* _1 J* _9 ~2 X# B# Z
  208. e-resize' c, y) @/ e. d" h3 ^9 Q; A7 {
  209. n-resize
    % j* y( D3 j) b0 p
  210. nw-resize
    ( V9 q  d, V/ t4 d/ M
  211. w-resize
    + R; u; e; X+ x) Q' C% k; }
  212. s-resize' L3 z( G. ]( X9 d
  213. se-resize
    9 n6 K( ^0 A" X! ~5 s* E
  214. sw-resize: ^+ c+ a% f3 w  N, E
  215. 1.本地无缓存,每次自动刷新* L2 M" ~6 x% F. O1 [* x
  216. response.expires=0
    ! d7 g$ _; P" b; D) t
  217. response.addheader"pragma","no-cache"
    2 W3 {* v; F+ j
  218. response.addheader"cache-control","private"+ U: M# E5 Q/ A
  219. 2.修改contenttype并下载gif等格式, o8 I8 S8 b( }- _9 B
  220. <%
    / [) q9 ]' }0 S3 A3 F
  221. functiondl(f,n). O2 l7 O1 Y5 W+ V, N  c/ q
  222. onerrorresumenext
    9 l! ~9 }% q0 h4 P9 Z% a
  223. sets=createobject("adodb.stream")
    : g# l% o0 ^; n4 n* ~/ B" D# M
  224. s.mode=3
    * A4 f  ]$ n# m4 K% f- H  I/ z
  225. s.type=1) L8 v. Z, Z, y: W: a
  226. s.open
    ! t* A8 D6 y) J/ b
  227. s.loadfromfile(server.mappath(f))
    " B2 v1 v/ Z( I" Q9 E) M
  228. iferr.number>0then
    7 {3 S4 m, S% ]% F
  229. response.writeerr.number&":"&err.description+ @  }5 P1 L% u' b& z0 B2 ^6 T" \
  230. else
    # l" x$ l3 c9 Q( C. _; P! Y
  231. response.contenttype="application/x-gzip"5 l8 {6 q, ?* H0 [+ R6 E* G- L
  232. response.addheader"content-disposition:","attachment;filename="&n
    * |3 T7 w( y/ W* T! M+ ]
  233. response.binarywrite(s.read(s.size))
    / u, K! Y/ R1 O6 _7 h8 v& v
  234. endif
    # @; @/ j7 F- A' {% D! {
  235. endfunction& b9 x( ^% ]: b. r5 e0 m' i9 K2 L
  236. calldl("012922501.gif","t1.gif")3 z* d" d/ w' j0 o' s( p
  237. %># P9 B: f( G( @6 C
  238. : ]0 j( p* r; J9 @& S+ l- v: D8 G8 d2 }
  239. 19.检查一段字符串是否全由数字组成( e# t, Q" B* x/ a. t+ {
  240. <scriptlanguage="javascript"><!--4 W5 X, z0 P& D# V
  241. functionchecknum(str){return!/\d/.test(str)}
    . _' S6 m5 |- m: F+ o. ^6 E
  242. alert(checknum("1232142141"))
    . Q* J+ b- ~1 L0 T4 E$ M- t  g0 m
  243. alert(checknum("123214214a1"))
    5 t& ]/ B6 }+ i/ j; |
  244. //--></script>
    + A* n# i# y0 }, m: V, v# V
  245. 20.获得一个窗口的大小9 \& e3 l( |' r: d
  246. document.body.clientwidth,document.body.clientheight
    : A% h% q5 T# {- d
  247. document.body.offsetwidth,document.body.offsetheight
    , N2 V' v, I. o  K% z
  248. 有时还需要知道window.screentop,window.screenleft' o$ R6 S2 J+ x" a# A( I, g% J4 R
  249. 21.怎么判断是否含有汉字
    : d: a5 Q- O" w
  250. if(escape(str).indexof("%u")!=-1)alert("含有汉字");( C, m6 e" ?/ {& n- j( w
  251. elsealert("全是字符");* v( @. G2 X! ~  d# b' J# @
  252. 22.textarea自适应文字行数的多少
    ; K) V6 f( `+ n& J
  253. ie5.5+可以用overflow-y:visible- C# A6 r+ R3 X5 X& P, V2 Y
  254. <textarearows=1name=s1cols=27style="overflow-y:visible">& V  S' Y# ~$ z: @
  255. </textarea>
    7 n: S7 W% z- t/ l/ a* l- B
  256. 23.日期减去天数等于第二个日期1 D9 T# F- N4 @, ]6 P! E
  257. <scriptlanguage=javascript>
    . z" ]9 A! k; k! ~) t
  258. functioncc(dd,dadd)
    5 g$ m% J" ^( a1 ?( {" ?
  259. {
    1 L! g) \2 m  e2 ]7 D
  260. //可以加上错误处理
    , w  y9 t. m' b( M+ Y0 |/ A/ h
  261. vard=newdate(dd.replace("-","/"))$ h  m" D. T9 b& B+ D0 Z' t7 h
  262. d.setdate(d.getdate()+dadd)
    3 ?" Y( z# i& N' c- R4 ^
  263. alert(d.getfullyear()+"年"+(d.getmonth()+1)+"月"+d.getdate()+"日")
    - X( j, U5 [: G7 R0 V! H6 W& b2 R& k
  264. }5 l9 h: R1 o0 W% O" j
  265. cc("2002-2-28",2)
    8 c8 i. y1 s+ Y" I# x
  266. <br>&lt;/script&gt;
复制代码
宣传/支持龙江曦月.龙江曦月需要理解,适宜长居
hyc0214 发表于 2005-10-16 19:18:17 | 显示全部楼层
5.ie地址栏前换成自己的图标1 P& q- d4 a- l! U' _/ X6 D
如何实现啊????
宣传/支持龙江曦月.龙江曦月需要理解,适宜长居
回复

使用道具 举报

itdesigner 发表于 2005-10-30 21:14:20 | 显示全部楼层
[B]以下是引用[I]hyc0214[/I]在2005-10-16 11:18:17的发言:[/B]<br>5.ie地址栏前换成自己的图标
; M+ k- P* b: X: p7 e- I! l! ?5 @如何实现啊????
- h6 Z) X* j7 n+ Z
加这行就可以了,4 {, P: Y! M) H
[B]<link rel=\"shortcut icon\" href=\"favicon.ico\" type=\"image/x-icon\" />[/B]( u0 L/ w6 e- f' d( R
不过需要注意把那个16色的图标放到网站根目录下,且大小必须为16*16,因为IE并不严格识别这标签,它会自己到网站的根目录下找,
4 M( ?* a( e  ?# ~1 a另外建议楼主转帖的时候稍整理、试用下再发上来,这样大家看起来就方便多了,而且也可以提高发帖的质量啊
宣传/支持龙江曦月.龙江曦月需要理解,适宜长居
回复

使用道具 举报

 楼主| 鹭岛の御风 发表于 2005-11-1 05:22:16 | 显示全部楼层
不亏是啊亮~厉害
宣传/支持龙江曦月.龙江曦月需要理解,适宜长居
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即加入

本版积分规则

手机版|龙江曦月 ( 闽ICP备05009150号-1 )闽公安网备35060202000316

GMT+8, 2025-5-26 12:50 , Processed in 0.042068 second(s), 21 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表