이 기간 동안 저는 Ajax 기술을 사용하여 일을 해왔으므로 JavaScript 지식을 배울 수있는 더 많은 기회가 있습니다. JavaScript의 IE Operation Online에서 일부 코드를 수집했습니다. 즉, FF에 문제가있을 것입니다. 공유하려면 지금 게시하십시오.
코드 사본은 다음과 같습니다.
1. 오른쪽 마우스 버튼이 완전히 차단됩니다
oncontextMenu = "window.event.returnValue = false"
테이블 <테이블 oncontextMenu = return (false)> <td> no </table>에 사용할 수 있습니다
2. 선택을 해제하고 복사하지 않도록합니다
<bodyonselectstart = "returnfalse">
3. 붙여 넣기는 허용되지 않습니다
onpaste = "returnfalse"
4. 복사를 방지하십시오
oncopy = "returnfalse;"
oncut = "returnfalse;"
5. IE 주소 표시 줄 앞에서 자신의 아이콘으로 변경하십시오.
<linkrel = "shortcuticon"href = "favicon.ico">
6. 좋아하는 아이콘을 표시 할 수 있습니다
<linkrel = "책갈피"href = "favicon.ico">
7. 입력 메소드를 끕니다
<inputStyle = "ime-mode : disabled">
8. 항상 프레임을 가지고 다니십시오
<scriptLanguage = "JavaScript">
<!-
if (window == top) top.location.href = "frames.htm";
//->
</스크립트>
9. 프레임이 존재하지 않도록합니다
<scriptLanguage = javaScript>
<!-
if (top.location! = self.location) top.location = self.location;
//->
</스크립트>
10. 웹 페이지는 저장되지 않습니다
<noscript> <iframesrc =*. html> </iframe> </noscript>
11. 웹 페이지 소스 코드를 봅니다
<입력 유형 = 버튼 값 = 웹 페이지보기 소스 코드 onclick = "window.location = 'view-source :'+'// www.vevb.com/">
12. 클라이언트가 ASP를 통해 에이전트를 사용하는지 확인하는 방법
<%ifrequest.servariables ( "http_x_forwarded_for") <> "" "". 그런 다음
response.write "<fontcolor =#ff0000> 프록시 서버를 통과했습니다"& _
"실제 IP는"& request.servervariables ( "http_x_forwarded_for")
endif
%>
13. 제어의 절대 위치를 얻으십시오
// JavaScript
<scriptLanguage = "JavaScript">
Functiongetie (e) ... {
Vart = E.OffSetTop;
varl = E.OffSetLeft;
while (e = e.offsetparent) .. {
t+= E.OffSetTop;
l+= E.OffSetLeft;
}
alert ( "top ="+t+"left ="+l);
}
</스크립트>
// vbscript
<scriptlanguage = "vbscript"> <!-
functiongetie ()
Dimt, L, A, b
seta = document.all.img1
t = document.all.img1.offsetTop
l = document.all.img1.offsetleft
whilea.tagname <> "Body"
seta = a.offsetparent
t = t+A.OffSetTop
L = L+A.OffSetLeft
향하게 하다
Msgbox "top ="& t & chr (13) & "left ="& l, 64, "제어 위치를 얻으십시오"
최종 기능 장애
->
</스크립트>
14. 커서가 텍스트 상자 끝에서 멈 춥니 다
<scriptLanguage = "JavaScript">
functioncc ()
... {
vare = event.srcelement;
varr = e.creatextrange ();
r.movestart ( '문자', e.value.length);
R.Collapse (True);
r.select ();
}
</스크립트>
<inputtype = textName = text1value = "123"onfocus = "cc ()">
15. 이전 페이지의 출처를 판단합니다
ASP :
request.servervariables ( "http_referer")
자바 스크립트 :
문서 .referrer
16. 창을 최소화하고 최대화하고 닫습니다
<objectId = hh1classid = "clsid : adb880a6-d8ff-11cf-9377-00aa003b7a11">
<paramname = "명령"value = "Minimize"> </object>
<objectId = hh2classid = "clsid : adb880a6-d8ff-11cf-9377-00aa003b7a11">
<paramname = "명령"value = "maximize"> </object>
<objectId = hh3classid = "clsid : adb880a6-d8ff-11cf-9377-00aa003b7a11">
<paramname = "명령"value = "close"> </object>
<inputtype = buttonValue = onclick = hh1.click ()>을 최소화합니다
<inputtype = buttonValue = onclick = hh2.click ()> 최대화
<inputtype = buttonValue = close onclick = hh3.click ()>
이 예제는 IE에 적용됩니다
17.
<%
'데이터베이스 연결에 대한 일부 상수를 정의하십시오
ConstAdopenforwardOnly = 0 '커서만 레코드를 브로우드 전진하고 페이징, 레코드 세트, 북마크를 지원하지 않습니다.
ConstAdopenKeyset = 1 '키 세트 커서, 다른 사용자가 레코드로 수정 한 수정은 레코드 세트에 반영되지만 다른 사용자는 레코드를 추가하거나 삭제하지 않습니다. 레코드 세트에 반영되지 않습니다. 페이지 매김, 레코드 세트, 북마크를 지원합니다
constadopendynamic = 2 '동적 커서는 가장 강력한 기능을 가지고 있지만 가장 많은 리소스도 소비합니다. 레코드에 대한 레코드의 수정, 추가 또는 삭제는 레코드 세트에 반영됩니다. 완전한 기능을 지원합니다 (액세스는 지원되지 않음).
ConstAdopenstatic = 3 '정적 커서는 사용자의 레코드의 수정, 추가 또는 삭제가 레코드 세트에 반영되지 않습니다. 앞으로 또는 후진 운동을 지원합니다
constadlockreadonly = 1 '잠금 유형, 기본값, 읽기 전용, 수정이 없음
constadlockpessimistic = 2 '편집 할 때 즉시 레코드 잠금, 가장 안전한 방법
constadlockoptimistic = 3 '레코드 세트는 업데이트 메소드가 호출 될 때만 잠겨 있으며 기타 이전 작업에서는 현재 레코드를 변경하고 삽입 및 삭제할 수 있습니다.
Constadlockbatchoptimistic = 4 '레코드는 편집 할 때 잠겨 있지 않으며 변경, 삽입 및 삭제는 배치 모드에서 수행됩니다.
constadcmdtext = & h0001
constadcmdtable = & h0002
%>
18. 웹 페이지는 캐시되지 않습니다
HTM 웹 페이지
<metahttp-equiv = "pragma"content = "no-cache">
<metahttp-equiv = "Cache-control"content = "no-cache, must-revalidate">
<metahttp-equiv = "만료"content = "wed, 26feb199708 : 21 : 57gmt">
또는 <metahttp-equiv = "만료"내용 = "0">
ASP 웹 페이지
응답 .expires = -1
응답 .expiresabsolute = now () -1
응답 .cachecontrol = "no-cache"
PHP 웹 페이지
헤더 ( "만료 : Mon, 26Jul199705 : 00 : 00GMT");
헤더 ( "캐시 제어 : 없음 캐시, 꼭 봐야 할 반복");
헤더 ( "Pragma : No-Cache");
19. 문자열이 숫자로 구성되어 있는지 확인하십시오
<scriptlanguage = "javaScript"> <!-
functionchecknum (str) {returnstr.match (/d/) == null}
경고 (Checknum ( "1232142141"))
경고 (Checknum ( "123214214a1"))
//-> </script>
20. 창의 크기를 얻습니다
document.body.clientWidth, document.body.clientHeight
21. 그것이 캐릭터인지 여부를 결정하는 방법
if (/[^�-ÿ] /g.test (s)) alert ( "중국어 포함");
elsealert ( "모든 문자");
22. 몇 줄의 Textarea 적응성 텍스트
<Textarearows = 1 name = s1 cols = 27 onpropertychange = "this.style.posheight = this.scrollheight">
</textarea>
23. 날짜 마이너스 일은 두 번째 날짜와 같습니다
<scriptLanguage = javaScript>
functioncc (dd, dadd)
{
// 오류 처리를 추가 할 수 있습니다
vara = Newdate (DD)
a = a.valueof ()
a = a-dadd*24*60*60*1000
a = NewDate (a)
ALERT (a.getLyEar ()+"Year"+(a.getMonth ()+1)+"Month"+a.getDate ()+"day")
}
CC ( "12/23/2002", 2)
</스크립트>
24. 라디오가 선택되었습니다
<html> <scriptlanguage = "vbscript">
functioncheckme ()
FORECHOBINRADIO1
ifob.checkedthenwindow.alertob.value
다음
최종 기능 장애
</script> <body>
<input name = "radio1"type = "radio"value = "Style"Checked> 스타일
<input name = "radio1"type = "radio"value = "barcode"> 바코드
<입력 유형 = "버튼"value = "check"onclick = "checkme ()">
</body> </html>
25. 요청을 얻으십시오 .Servariables ( "")이 페이지에서 URL 모음.
response.write "<tableborder = 1> <!-테이블 헤더-> <tr> <td> <b> 변수 </b> </td> <td> value </b> </td> </tr> "
foreachobinrequest.servervaribles
response.write "<tr> <td>"& ob & "</td> <td>"& request.servervariables (ob) & "</td> </tr>"
다음
response.write "</table>"
26.
기본 IP <%= request.servariables ( "remote_addr")%>
서버 이름 <%= request.servervariables ( "server_name")%>
서버 IP <%= request.servariables ( "local_addr")%>
서버 포트 <%= request.servervariables ( "server_port")%>
서버 시간 <%= now%>
IIS 버전 <%= request.ServerVariables "Server_Software")%>
스크립트 타임 아웃 시간 <%= server.scriptTimeout%>
이 파일의 경로는 <%= server.mappath (request.servervariables ( "script_name"))%입니다
서버 cpus 수 <%= request.servervariables ( "number_of_processors")%>
서버 해석 엔진 <%= scriptenge & "& scriptenginemajorversion &"& scriptengeineminorversion & "
서버 운영 체제 <%= request.servervariables ( "OS")%>
27. 엔터 키는 커서가 다음 입력 상자로 이동할 수 있도록합니다.
<input onkeydown = "if (event.keyCode == 13) event.KeyCode = 9">
28. 특정 웹 사이트의 링크 속도 감지 :
<body> 영역에 다음 코드를 추가하십시오.
<scriptLanguage = javaScript>
Tim = 1
setInterval ( "TIM ++", 100)
b = 1
varautourl = newArray ()
autourl [1] = "<src ="pic/url.gif "align = absmiddle border = 0> www.njcatv.net"
autourl [2] = "javacool.3322.net"
autourl [3] = "<src ="pic/url.gif "align = absmiddle border = 0> www.sina.com.cn"
Autourl [4] = "www.nuaa.edu.cn"
autourl [5] = "<src ="pic/url.gif "align = absmiddle border = 0> www.cctv.com"
functionbutt () {
document.write ( "<formname = autof>")
for (vari = 1; i <autourl.length; i ++)
document.write ( "<inputtype = textname = txt"+i+"size = 10Value = test ...> =》 <inputType = 텍스트 나임 = url"+i+"size = 40> =》 <inputtype = buttonValue = goonClick = 창 .open (this.form.url "+i+". value)> <br/> ")
document.write ( "<inputtype = submitvalue = refresh> </form>")
}
대상()
functionAuto (url) {
document.forms [0] [ "url"+b] .Value = url
if (Tim> 200)
{document.forms [0] [ "txt"+b] .Value = "Link TimeOut"}}
또 다른
{document.forms [0] [ "txt"+b] .Value = "time"+tim/10+"seconds"}}
B +++
}
functionrun () {for (vari = 1; i <autourl.length; i ++) document.write ( "<imgsrc = http : //"+autourl [i]+"/"+math.random ()+"width = 1height = 1onerror = auto ( '<src = "pic/url.gif"align = absmiddle 테두리 = 0> http : // ";+autourl [i]+"'))}}
run () </script>
29. 다양한 스타일의 커서
자동 : 표준 커서
기본값 : 표준 화살표
손 : 손 커서
기다려 : 커서를 기다리십시오
텍스트 : i 자형 커서
수직 텍스트 : 수평 i 자형 커서
드롭 없음 : 커서를 드래그 할 수 없습니다
획기되지 않은 : 유효하지 않은 커서
도움말 :? 도와주세요 커서
모든 스크롤 : 삼각형 방향 마크
이동 : 모바일 태그
크로스 헤어 : 크로스 헤어
e- 레드 크기
N- 레드 크기
NW- 레드 크기
W- 레드 사이즈
S-Resize
SE- 레드 크기
SW-Resize
1. 로컬로 캐시가없고 매번 자동으로 새로 고치십시오
응답 .expires = 0
Response.addheader "Pragma", "No-Cache"
response.addheader "Cache-Control", "Private"
2. ContentType를 수정하고 GIF 및 기타 형식을 다운로드하십시오
<%
functiondl (f, n)
onerrorresumenext
sets = createobject ( "adodb.stream")
S. 모드 = 3
s.type = 1
S. OPEN
s.loadfromfile (Server.mappath (f))
iferr.number> 0then
response.writeerr.number & ":"& err.description
또 다른
응답 .ContentType = "application/x-gzip"
response.addheader "Content-Disposition :", "첨부 파일; filename ="& n
응답.
endif
최종 기능 장애
calldl ( "012922501.gif", "t1.gif")
%>
19. 문자열이 숫자로 구성되어 있는지 확인하십시오
<scriptlanguage = "javaScript"> <!-
functionchecknum (str) .. {return! /d/.test (str)}
경고 (Checknum ( "1232142141"))
경고 (Checknum ( "123214214a1"))
//-> </script>
20. 창의 크기를 얻습니다
document.body.clientWidth, document.body.clientHeight
document.body.offsetwidth, document.body.offsetheight
때로는 Window.screentop, Window.screenLeft를 알아야합니다
21. 한자가 포함되어 있는지 여부를 결정하는 방법
if (Escape (str) .indexof ( "%u")! = -1) alert ( "중국어 포함");
elsealert ( "모든 문자");
22. 몇 줄의 Textarea 적응성 텍스트
IE5.5+는 Overflow-Y : Visible을 사용할 수 있습니다
<textarearows = 1name = s1cols = 27style = "Overflow-Y : Visible">
</textarea>
23. 날짜 마이너스 일은 두 번째 날짜와 같습니다
<scriptLanguage = javaScript>
기능 CC (DD, DADD)
... {
// 오류 처리를 추가 할 수 있습니다
vard = newdate (dd.replace ( "-", "/"))
d.setDate (d.getDate ()+dadd)
ALERT (D.GetLyEar ()+"Year"+(D.GetMonth ()+1)+"Month"+D.GetDate ()+"Day")
}
CC ( "2002-2-28", 2)
</스크립트>