로그인

이메일
비밀번호
DaeYoung's Blog : 위치로그 : 태그 : 방명록 : 관리자 : 새글쓰기
Java Script 간단한 글래스 만들기
Web/JavaScript, (2007년 04월 26일 14시 46분)
<SCRIPT LANGUAGE="JavaScript">
<!--
//자바스크립트 클래스 정의

Member = function(name, id){ //클래스 정의(생성자에 해당함)
        this.name = name ;
        this.id = id ;
}

Member.prototype.setValue = function(newName, newId){
        /* prototype는 클래스에 매소드를 정의할때 사용된다.*/
        this.name = newName ;
        this.id = newId ;
}

Member.prototype.getName = function(){
        return this.name;
}

Member.prototype.getId = function(){
        return this.id;
}


var mem = new Member("홍길동","hong"); //객체선언
document.write(mem.name); // 홍길동
document.write(mem.id); // 아이디

mem.setValue("임꺽정","imguk"); // set매소드로 값입력
document.write(mem.getName()); // 값반환 //임꺽정
document.write(mem.getId()); //imguk

//-->
</SCRIPT>
http://laedu.net/trackback/9
documentElement.innerHTML 간단하게 보기
Web/Ajax, (2007년 04월 26일 14시 42분)

주소창에
javascript:alert(document.documentElement.innerHTML);

http://laedu.net/trackback/8
From. 비아그라 구매 2026년 06월 23일 21시 11분Delete / Modify
비아그라 구매
DaeYoung's Blog ::
XML 응답
Web/Ajax, (2007년 04월 26일 14시 15분)
book.jsp ==============================
<?xml version="1.0" encoding="euc-kr" ?>
<%@ page contentType="text/xml; charset=EUC-KR"%>

<books>
        <book>
                <title>성공적인 웹 프로그....</title>
                <author>아무개</author>
        </book>
        <book>
                <title>웹 프로그....</title>
                <author>무</author>
        </book>
        <book>
                <title>로그....</title>
                <author>개</author>
        </book>0
</books>



httpReq.js=====================================

function getXMLRequest(){
        if(window.ActiveXObject){
                try{
                        //Msxml2.XMLHTTP객첵가 상위버전
                        return new ActiveXObject("Msxml2.XMLHTTP");
                }catch(e){
                        try{
                                //Msxml2.XMLHTTP 실패시 하위버전 객체 선언
                                return new ActiveXObject("Microsoft.XMLHTTP");
                        }catch(e1){
                                return null;
                        }
                }
        }else if(window.XMLHttpRequest){
                return new XMLHttpRequest(); //IE 이외 브라우저
        }else{
                return null;
        }
}

//XMLHttpRequest 객체 구하기
var httpRequest = null ;

function sendRequest(url, params, callback, method){
        httpRequest = getXMLRequest();

        var httpMethod = method?method:'GET';
        if(httpMethod != 'GET' && httpMethod != 'POST'){
                httpMethod = 'GET';
        }
        var httpParams = (params == null || params=='')?null:params;
        var httpUrl = url ;
        if(httpMethod == 'GET' && httpParams != null){
                httpUrl = httpUrl+"?"+httpParams
        }
        httpRequest.open(httpMethod, httpUrl, true);
        httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        httpRequest.onreadystatechange = callback;
        httpRequest.send(httpMethod=='POST'?httpParams:null);
}



view.html=========================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html
 xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko" lang="ko">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<script type="text/javascript" src="httpReq.js"></script>
<script type="text/javascript">
        function loadBooks(){
                sendRequest("book.jsp", null, loadedBooks, "GET");
        }

        function loadedBooks(){
                if(httpRequest.readyState==4){
                        if(httpRequest.status==200){

                                var xmlDoc = httpRequest.responseXML;
                                var bookList = xmlDoc.getElementsByTagName("book");
                                var message = "총 개수 :"+bookList.length+"권\n";

                                for(i=0; i<bookList.length; i++){
                                        var book = bookList.item(i);
                                        var title = book.getElementsByTagName("title").item(0).firstChild.nodeValue;
                                        var author =book.getElementsByTagName("author").item0).firstChild.nodeValue;
                                        message += title+"("+author+")\n";
                                }

                                document.getElementById("here").innerHTML=message ;

                        }
                }
        }
        window.onload=function(){
                loadBooks();
        }

</script>
<title>Insert title here</title>
</head>
<body>
<div id="here"></div>
</body>
</html>


결과 ========================================
총 개수 :3권
성공적인 웹 프로그....(아무개)
웹 프로그....(무)
로그....(개)

http://laedu.net/trackback/7
DaeYoung's Blog 블로그에 오신것을 환영해요^^
웹기반 프로그래밍에 관한 것들을 모을 예정이었는데..
«   2026년 06월   »
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30        
Javax.mail 참고 사이트.
C# TextBox KeyDown, KeyPr...
SID가 여러개 있을때 'ORA...
비아그라 구매.
비아그라 구매 06월 23일
비아그라 구매 사이트.
비아그라 구매 사이트 06월 22일
비아그라 구매.
비아그라 구매 06월 21일
비아그라 구매.
비아그라 구매 06월 15일
비아그라 구입.
비아그라 구입 06월 11일
307
326
1290375