JavaScript

[AJAX] JS - AJAX - ASP 아작스 예제 (= 입력제시어 = 입력예제)

PHP와 작동 메커니즘 동일

https://homzzang.com/b/js-84

 


b.asp

<p>제시어: <span id="txtHint"></span></p> 


<p>입력: <input type="text" id="txt1" onkeyup="hz(this.value)"></p>


<script>

function hz(str) {

  var xhttp;

  if (str.length == 0) { 

    document.getElementById("txtHint").innerHTML = "";

    return;

  }

  xhttp = new XMLHttpRequest();

  xhttp.onreadystatechange = function() {

    if (this.readyState == 4 && this.status == 200) {

      document.getElementById("txtHint").innerHTML = this.responseText;

    }

  };

  xhttp.open("GET", "a.asp?q="+str, true);

  xhttp.send();

}

</script>


 

a.asp

 

<%

response.expires=-1

dim a(2)

a(1)="홈짱닷컴"

a(2)="Homzzang.com"


q=ucase(request.querystring("q"))


if len(q)>0 then

  hint=""

  for i=1 to 2

    if q=ucase(mid(a(i),1,len(q))) then

      if hint="" then

        hint=a(i)

      else

        hint=hint & " , " & a(i)

      end if

    end if

  next

end if


if hint="" then

  response.write("제시어 없음")

else

  response.write(hint)

end if

%>

 

 

 


분류 제목
Form JS - Forms - 폼양식 유효성 제어
Form JS - Forms API - 폼유효성
Object JS - Object - 객체개념(=객체의미=객체정의) ★ 3
Object JS - Object Property - 객체속성 ★
Object JS - Object Methods - 객체메서드 ★
Object JS - Object Accessors - 객체접근자 (Getter/Setter = 게러/세러 = 게터/세터… 2
Functions JS - Function Definition - 함수선언방법 + 함수호출방법 ★★★ (= 함수구문 + 함수특…
Functions JS - Function Parameter/argument - 함수 (매개변수/독립변수) ※ 변수 종류 ※ …
Functions JS - Function Invocation - 함수호출방법1 = (함수방식 + 메서드방식 + 함수생성자방…
Functions JS - call() 메서드 - 함수호출방법2 (= call메서드 = 콜메서드)
DOM JS - DOM (= 돔 = 문서객체모델) 정의
DOM JS - Method - 메서드 (= HTML 요소에 대한 수행 작업)
DOM JS - Document - 문서객체
DOM JS - Element Selector - 주요 요소선택자 (= 객체찾기) ※ JS외부링크호출 주의사항
DOM JS - HTML - 내용입력/내용변경/속성값변경(=속성값입력)
4/89
목록
 홈  PC버전 로그인 일본어
그누앞단언어
그누뒷단언어
그외코딩언어
그누보드
제작의뢰
Q&A
커뮤니티 2
웹유틸
회원센터
홈짱닷컴 PC버전 로그인