권장 : ASP는 XML을 사용하여 지정된 폴더를 패키지하고 웹 디렉토리에 업로드하고 자체적으로 포장을 풀어줍니다. '= ====================================================================================================================================================================================== data.s upload data.xml에 대한 data.xml 및 파일 2 (install.xml)에서 data.xml 파일을 생성합니다. 파일 '=============================== % 옵션 explic
ASP Online Q & A의 예제 코드는 HTML 파일이며 테스트 .asp이며 코드는 다음과 같습니다.
- <%@language = vbscriptCodePage = 936%>
- <%
- ifsession (username) = 그런 다음
- response.write (<cript> alert ( '로그인 한 다음 작업을 수행 한 다음 작업을 수행하십시오!'); Window.location = 'login.asp? reurl = test.asp'; </script>)
- 응답 ()
- endif
- %>
- <! doctypehtmlpublic- // w3c // dtdxhtml1.0transitional // enhttp : //www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd>
- <htmlxmlns = http : //www.w3.org/1999/xhtml>
- <헤드>
- <metahttp-equiv = content-typecontent = text/html; charset = gb2312/>
- <title> 시나리오 Q & A </title>
- <styletype = text/css>
- <!-
- 몸{}{
- 글꼴 크기 : 12px;
- 색상 :#0066ff;
- }
- 입력{}{
- 국경 : 1pxsolid#ffffff;
- 배경색 : #eeeee;
- 왼쪽 : 1px;
- 상단 : 1px;
- 오른쪽 : 1px;
- 하단 : 1px;
- 클립 : rect (10px, 10px, 10px, 10px);
- 마진 : 1px;
- 패딩 : 1px;
- }
- ->
- </스타일>
- </head>
- <scriptLanguage = javaScript>
- <!-
- functionchkform ()
- {
- vare = document.frm;
- varit, 깃발, i;
- flag = false;
- for (i = 1; i <= 10; i ++)
- {
- 변형 = 평가 (e.question+i);
- variantLen = Eval (e.question+i+.length);
- for (varj = 0; j <itlen; j ++)
- {
- varitchk = eval (e.question+i+[+j+]. 확인);
- if (itchk)
- {
- flag = true;
- 부서지다;
- }
- if (! itchk && j == itlen-1)
- {
- flag = false;
- 부서지다;
- }
- }
- if (! 플래그)
- {
- 경고 (질문 +i +에 대한 답변을 선택하십시오);
- returnfalse;
- }
- }
- if (! 플래그)
- {
- 경고 (질문 +i +에 대한 답변을 선택하십시오);
- 평가 (e.question+i+.focus ());
- returnfalse;
- }
- returntrue;
- }
- ->
- </스크립트>
- <body>
- <div> <strong> 시나리오 Q & A </strong> </div>
- <formname = frmaction = test_do.aspmethod = postonsubmit = return (chkform ());>
- <p> <br/>
- 1. 잊혀진 주인공의 이름은 무엇입니까? <br/>
- <라벨>
- <inputtype = radioname = Question1Value = a/>
- a. </label>
- lan <br/>
- <라벨>
- <inputtype = radioname = Question1value = b/>
- b. </label>
- Jenny <br/> <label>
- <inputtype = radioname = Question1value = c/>
- c. </label> 루시 </p>
- <p> 2. 음악의 과거에 바의 이름은 무엇입니까? <br/>
- <라벨>
- <inputtype = radioname = Question2value = a/>
- a. </label>
- 잊혀진 <br/>
- <라벨>
- <inputtype = radioname = Question2value = b/>
- b. </label>
- nv <br/>
- <라벨>
- <inputtype = radioname = Question2value = c/>
- c. </label>
- 그림자처럼 </p>
- <p> 3. 잊혀진 사진의 벽에 어떤 사진이 있습니까? <br/>
- <라벨>
- <inputtype = radioname = Question3Value = a/>
- a. </label>
- 과거의여 주인공 <br/>
- <라벨>
- <inputtype = radioname = Question3Value = b/>
- b. </label>
- 바다의 풍경 <br/>
- <라벨>
- <inputtype = radioname = Question3Value = c/>
- c. </label>
- 막대 외부 </p>
- <p> 4. 과거의 주인공이 과거 음악에서 마시는 와인의 이름은 무엇입니까? <br/>
- <라벨>
- <inputtype = radioname = Question4Value = a/>
- a. </label>
- 레드 핑크 뷰티 <br/>
- <라벨>
- <inputtype = radioname = Question4Value = b/>
- b. </label>
- 일곱색의 무지개 <br/>
- <라벨>
- <inputtype = radioname = Question4Value = c/>
- c. </label>
- 코스타 델 Azure </p>
- <p> 5. 건망증에서 Newvision 잡지의 표지는 누구입니까? <br/>
- <라벨>
- <inputtype = radioname = Question5value = a/>
- a. </label> xuanbin <br/>
- <라벨>
- <inputtype = radioname = Question5value = b/>
- b. </label> 비 <br/>
- <라벨>
- <inputtype = radioname = Question5value = c/>
- c. </label> Zhang Dongjian </p>
- <p> 6. 과거 음악의 레코드 이름은 무엇입니까? <br/>
- <라벨>
- <inputtype = radioname = Question6Value = a/>
- a. </label>
- Bewitched <br/>
- <라벨>
- <inputtype = radioname = Question6Value = b/>
- b. </label>
- 멋진 <br/>
- <라벨>
- <inputtype = radioname = Question6Value = c/>
- c. </label>
- 아름다운 </p>
- <p> 7. 음악의 과거에 바의 벽에 무엇이 쓰여졌습니까? <br/>
- <라벨>
- <inputtype = radioname = Question7Value = a/>
- a. </label>
- loveisbeautiful <br/>
- <label> <inputtype = radioname = Question7Value = b/>
- b. </label>
- TruthIsbeautiful <br/>
- <label> <inputtype = radioname = Question7Value = c/>
- c. </label>
- Smileisbeautiful </p>
- <p> 8. 음악의 과거에 바에는 무엇입니까? <br/>
- <label> <inputtype = radioname = grate8value = a/>
- a. </label>
- gramophone <br/>
- <label> <inputtype = radioname = grate8value = b/>
- b. </label>
- 라디오 <br/>
- <label> <inputtype = radioname = grate8value = c/>
- c. </label>
- 비닐 레코드 </p>
- <p> 9. 과거 음악에서 남성 주인공의 선호는 무엇입니까? <br/>
- <label> <inputtype = radioname = Question9Value = a/>
- a. </label>
- 영화 <br/>
- <label> <inputtype = radioname = Question9Value = b/>
- b. </label>
- 사진 <br/>
- <label> <inputtype = radioname = Question9Value = c/>
- c. </label>
- 담배와 음악 </p>
- <p> 10. 재사용 대기 시간과 놀라움에서 주인공의 취미는 무엇입니까? <br/>
- <label> <inputtype = radioname = Question10Value = a/>
- a. </label>
- 여행 <br/>
- <label> <inputtype = radioname = Question10Value = b/>
- b. </label>
- 사진 <br/>
- <label> <inputtype = radioname = Question10Value = c/>
- c. </label>
- 온라인으로 가십시오 </p>
- <p> <br/>
- <inputtype = admbername = 제출 value = 제출/
- <br/>
- </p>
- </form>
- </body>
- </html>
다음은 배경 코드 Test_do.asp이며 코드는 다음과 같습니다.
- <%@language = vbscriptCodePage = 936%>
- <!-#includefile = conn.asp->
- <!-#includefile = function.asp->
- <%
- 응답 .cachecontrol = no-cache
- 응답 .expires = -1
- 응답 .expiresabsolute = now () -1
- ifsession (username) = 그런 다음
- response.write (<cript> alert ( '로그인 한 다음 작동!'); window.location = 'login.asp? reurl = nv_scene_test.asp'; </script>)
- 응답 ()
- endif
- '정의 옵션의 가장 높은 점수는 총 점수입니다.
- consttotalscore = 100
- constitems = 10
- '옵션 점수 정의
- Dimresult (9)
- '첫 번째 질문에 대한 점수 기준
- 결과 (0) = a | 10 | _ | b | 0 | _ | c | 0
- '질문 2의 점수 기준
- 결과 (1) = a | 0 | _ | b | 10 | _ | c | 0
- '세 번째 질문 점수 기준
- 결과 (2) = a | 10 | _ | b | 0 | _ | c | 0
- '질문 4 점수 표준
- 결과 (3) = a | 0 | _ | b | 0 | _ | c | 10
- '질문 5 점수 표준
- 결과 (4) = a | 0 | _ | b | 0 | _ | c | 10
- '질문 6 점수 기준
- 결과 (5) = a | 10 | _ | b | 0 | _ | c | 0
- '질문 7 점수 기준
- 결과 (6) = a | 0 | _ | b | 10 | _ | c | 0
- '질문 8 점수 기준
- 결과 (7) = a | 10 | _ | b | 0 | _ | c | 0
- '질문 9 점수 기준
- 결과 (8) = a | 0 | _ | b | 0 | _ | c | 10
- '질문 10 번째 점수 기준
- 결과 (9) = a | 0 | _ | b | 10 | _ | c | 0
- ''질문 11 점수 기준
- '결과 (10) = a | 0 | _ | b | 0 | _ | c | 10
- '
- ''질문 12 점수 기준
- '결과 (11) = a | 0 | _ | b | 10 | _ | c | 0
- '
- ''질문 13 점수 기준
- '결과 (12) = a | 10 | _ | b | 0 | _ | c | 0
- '
- ``질문 14 번째 점수 기준
- '결과 (13) = a | 0 | _ | b | 10 | _ | c | 0
- '
- ``질문 15 번째 점수 기준
- '결과 (14) = a | 0 | _ | b | 0 | _ | c | 10
- ifucase (request.servervariables (request_method)) = postthen
- callchk_post ()
- Dimi, Total, Selitem, 요약, Strdes, Strout
- 총 = 0
- fori = 0to (항목 -1)
- selval = trim (request.form (question & i+1))
- arritem = split (결과 (i), | _ |)
- forj = 0toubound (arritem)
- ifselval = split (arritem (j), |) (0) 그러면
- TotalTotal = Total+Cint (split (arritem (j), |) (1))
- selitemselitem = selitem & <li> 질문 및 i+1 & : & selval & </li> & vbcrlf
- endif
- 다음
- 다음
- 요약 = 형식 (Total/TotalScore)
- if (Total/Totalscore)> = 0.6then
- strdes = 규칙 성 & 요약 & <br> 성공적으로 통과했습니다
- 또 다른
- strdes = result & summary & <br> 슬프게도 정확도는 60%에 도달하지 않았습니다. 다시 시도하십시오! <br> <ahref = test.asp '> 온라인 Q & A 페이지로 돌아 가기 >> </a>
- endif
- Strout = youHavEsectedTheSeitemSbelow : <br> & selitem & <br> Total : & Total & <br> 귀하의 정확성은 다음과 같습니다. & Summary
- StroutStrout = Strout & <br> & strdes
- str_sql = selectCount (1) fromUserInfowHerememberId = '& session (id) &'
- rowCount = DataConn.Execute (str_sql) (0)
- ifrowcount> 0then'update 개인 정보가 존재하는 경우
- str_sql = UpdateUserInfo
- str_sqlstr_sql = str_sql & setresult = '& formatnumber (Total/Totalscore, 2) &'
- str_sqlstr_sql = str_sql &, ip = '& get_userip () &'
- str_sqlstr_sql = str_sql &, addtime = getDate ()
- str_sqlstr_sql = str_sql & wherememberid = '& session (id) &'
- 또 다른
- str_sql = insertIntouserInfo (result, memberid, membername, ip)
- str_sqlstr_sql = str_sql & values ( '& formatnumber (Total/Totalscore, 2) &', '& session (id) &', '& session (username) &', '& get_userip () &')
- endif
- DataConn.Execute (str_sql)
- endif
- %>
- <! doctypehtmlpublic- // w3c // dtdxhtml1.0transitional // enhttp : //www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd>
- <htmlxmlns = http : //www.w3.org/1999/xhtml>
- <헤드>
- <metahttp-equiv = content-typecontent = text/html; charset = gb2312/>
- <title> 온라인 Q & A 테스트 결과 </title>
- <styletype = text/css>
- <!-
- 몸{
- 글꼴 크기 : 12px;
- 색상 :#0066ff;
- }
- 입력{
- 국경 : 1pxsolid#ffffff;
- 배경색 : #eeeee;
- 왼쪽 : 1px;
- 상단 : 1px;
- 오른쪽 : 1px;
- 하단 : 1px;
- 클립 : rect (10px, 10px, 10px, 10px);
- 마진 : 1px;
- 패딩 : 1px;
- }
- ->
- </스타일>
- </head>
- <body>
- <%response.write (Strout)%>
- </body>
- </html>
공유 : ASP 오류 개체에 대한 팁 vbscript에는 스크립트 통역사가 런타임 오류를 무시하고 스크립트 코드의 실행을 계속하게하는 ON ERROR 이력서 다음 문이 있습니다. 그런 다음 스크립트는 err.number 속성의 값을 확인하여 오류가 발생했는지 확인할 수 있습니다. 오류가 발생하면 0이 아닌 값이 반환됩니다. ASP 3.0에서는 오류가 발생하여 기본값으로 "돌아 가기"에 사용할 수도 있습니다.