'Programming/HTML/JavaScript'에 해당되는 글 5건

  1. JSLint 자바스크립트 검증해주는 웹사이트 1
  2. 웹사이트에서 사용되는 로딩이미지를 만들어주는 사이트
  3. javascript handle of control visibility and display
  4. [javascript] Scope-safe constructor
  5. 정해진 시간후에 텍스트 자동으로 감추기

JSLint 자바스크립트 검증해주는 웹사이트입니다. 개발한 자바스크립트 코드를 해당 웹사이트로 이동하여 텍스트박스에 붙여 넣고, 검증을 해볼 수 있습니다.

주소는 http://jslint.com 입니다. 비주얼스튜디오에 연동되는 플러그인도 제공을 하고 있습니다. http://jslint.codeplex.com 입니다.

http://www.ajaxload.info

웹사이트에서 사용되는 로딩이미지를 만들어주는 사이트입니다.


visibility: 영역을 차지한다.
display: 영역을 차지하지 않는다.

** Usage
control.style.visibility = [value: visible(보이기) | hidden(감추기)]

control.style.display = [value: block(보이기) | none(감추기)]

function Student(name, grade, age){
    this.name = name;
    this.grade = grade;
    this.age = age;
}

var student = Student("Woody Choi", 1, 20);
alert(student.name);
alert(student.grade);
alert(student.age);

new 생성자 없이 Student를 선언을 하면 에러가 발생하게 된다. 왜냐하면, this를 window로 인식을 하게 되기 때문이다. 이를 해결하기 위해서 다음과 같은 처리를 할 수 있다.

Self-scope 생성자는 먼저 this가 Student type인지를 확인하고, 그렇지 않으면 new 를 이용하여 객체를 생성한다.

function Student(name, grade, age){
 if (this instanceof Student){
  this.name = name;
  this.grade = grade;
  this.job = job;  
 }
 else{
  return new Student(name, grade, age);
 }
}

        var student = Student("Woody", 1, 34);
        alert(student.name);
        alert(student.grade);
        alert(student.age);


 

        setTimeout(infoTimeout, 1000)

        function hideTextTimeout() {
            timeout = timeout - 1;
            if (timeout > 0) {
                // show message to say that saving is completed
                document.getElementById(_messageDiv).innerHTML = "message";
                setTimeout(hideText, 1000); // call reculsively
            }
            else {
                // clear message
                document.getElementById(_messageDiv).innerHTML = "";
            }
        }