Sample Image
공지: 보이드리얼리티 베타 서비스가 시작 됐습니다. (2025-03-09 13:13:36)

프로그래밍 >

450 자바스크립트 질문좀(글 제대로 수정함) ㅇㅇ 2025-03-02 05:16:03 92
ㅇㅇ | 2025-03-02 05:16:03 | 92 hits

test2.html  코드임




<!DOCTYPE html>
<html>
<head>
<title>test</title>
<style>
form {
    width: 330px;
    margin: 20px;
    background-color: pink;
    Padding: 20px;
}

input {
    text-align: right;
}
</style>

<script type="text/javascript">





    var pw;
    function create_form(_name, _action, _method, _target) {

        var instance = document.createElement("form");
        instance.name = _name;
        instance.action = _action;
        instance.method = _method;
        instance.target = _target;

        return instance;
    }

    function create_input_to_form(_form, _type, _name, _value) {
        var form_instance = _form;
        var input_instance = document.createElement("input");

        input_instance.type = _type;
        input_instance.name = _name;
        input_instance.value = _value;

        form_instance.insertBefore(input_instance, null);

        return form_instance;
    }

    function insert_form_to_html(_form) {
        document.body.insertBefore(_form, null);
    }

    function init() {
        var instance = create_form("nuForm", "Test3.html", "post", "postWindow");
        insert_form_to_html(instance);
        pw = window.open("", "postWindow", "width=300, height=400");
        instance.submit();

        if (pw == null) {
            alert("error;");
        } else {


            pw.onload = function() {
                alert("wow2");
                console.log("4");
            }
            console.log("2");
            console.log(pw);
            setTimeout(function() {
                if (pw==null) {
                    alert("pw is null");
                }
                else {
                    //console.log(document.domain);
                    console.log(pw);
                    //alert(pw.title);
                }

            }, 3000);
            console.log("3");
        }

    }
</script>
</head>

<body onLoad="init();">

</body>
</html>  



test3.html 코드임

<!DOCTYPE html>
<html>
<head>
<title>Insert title here</title>
</head>
<body>popup bodys
</body>
</html>


첫번째문제는 pw값이 setTimeout()시점에서 증발해버린다느점이고(pw 전역변수임 보다시피)

두번째문제는 pw.onload가 팝업창이 완전히 다 열리고 나서까지도 실행이 안된다는거임


참고로 구글크롬 콘솔 내용은 다음과같다

2 Test2.html:69

'window.webkitStorageInfo' is deprecated. Please use 'navigator.webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead. VM56:423

Window {top: Window, window: Window, location: Location, external: Object, chrome: Object…}

 Test2.html:70

3 Test2.html:82

Window {} 






ㅁㄴㅇㅁㄴㅇㅁㄴㅇㅁㄴㅇㅁㄴㅇ

(^오^) "Cool~" 0 | (-_-) "Damn!" 0
목록 수정  삭제
목록 수정 삭제

프로그래밍 프로세스

스레드 작성
458 불행의 [0] ㅇㅇ 2025-03-04 02:16:40 101
ㅇㅇ | 2025-03-04 02:16:40 | 101 hits
457 미개한 C++로는 절대로 불가능한 것.code [0] ㄴㄴㄴ 2025-03-04 00:43:17 102
ㄴㄴㄴ | 2025-03-04 00:43:17 | 102 hits
456 40만원정도 선으로 코딩용 노트북 있을까요? [0] ㅁㄴㅇ 2025-03-03 23:09:47 130
ㅁㄴㅇ | 2025-03-03 23:09:47 | 130 hits
455 Ruby는 아름다운거 같은데 Ruby충은 병x이군요 ^^ [0] ㅁㄴㅇㄹ 2025-03-03 21:36:15 82
ㅁㄴㅇㄹ | 2025-03-03 21:36:15 | 82 hits
454 미개한 C++로는 절대로 불가능한 Ruby느님의 언어.jpg [0] dd 2025-03-03 20:02:30 94
dd | 2025-03-03 20:02:30 | 94 hits
453 Ruby 충새끼들은 대대손손 Ruby만 쓰시기 바랍니다. [0] ㅁㄴㅇㄹ 2025-03-03 18:29:07 99
ㅁㄴㅇㄹ | 2025-03-03 18:29:07 | 99 hits
452 당신의 뒷조사를 할때 사용되는 안드로이드폰(맛폰으로 보세요, 엑박이면 X표시를 클릭) [0] ㅇㅇ 2025-03-03 16:55:32 77
ㅇㅇ | 2025-03-03 16:55:32 | 77 hits
451 자바 스레드 동기화 쩌네 [0] 수크라제 2025-03-02 09:56:21 90
수크라제 | 2025-03-02 09:56:21 | 90 hits
450 자바스크립트 질문좀(글 제대로 수정함) [0] ㅇㅇ 2025-03-02 05:16:03 92
ㅇㅇ | 2025-03-02 05:16:03 | 92 hits
449 Ruby가 좋은 이유를 코드로 설명.ruby [0] ㅇㅇ 2025-03-02 03:42:33 108
ㅇㅇ | 2025-03-02 03:42:33 | 108 hits
448 안드로이드로 제작된 앱 JSP서버로 포팅하려면 얼마나 걸려? [0] Reinvert 2025-03-02 02:08:59 99
Reinvert | 2025-03-02 02:08:59 | 99 hits
447 나도 수학잘해서 학창시절에 칭찬받고싶었는데 [0] ㅇㅇ 2025-03-01 23:01:50 96
ㅇㅇ | 2025-03-01 23:01:50 | 96 hits
446 C++ 질문하나 하자 [0] ㅁㄴㅇㄹ 2025-03-01 21:28:14 100
ㅁㄴㅇㄹ | 2025-03-01 21:28:14 | 100 hits
445 나두 카톡봇같은거나 간단한 2d게임만들고싶은뎅 뭐부터할까 [0] ㅂㄷㄱㅋㅇㄹ 2025-03-01 18:20:44 104
ㅂㄷㄱㅋㅇㄹ | 2025-03-01 18:20:44 | 104 hits
444 이길로 들어선게 너무 후회된다.SSUL [0] 자바는사람잡아 2025-03-01 16:47:14 99
자바는사람잡아 | 2025-03-01 16:47:14 | 99 hits
443 프리랜서로 월천찍을라면 얼마나 잘해야되요? [0] ㅇㅇ 2025-03-01 15:13:28 107
ㅇㅇ | 2025-03-01 15:13:28 | 107 hits
442 형들.. 제발 도움좀 부탁해 [0] ㅇㅇ 2025-03-01 13:39:49 96
ㅇㅇ | 2025-03-01 13:39:49 | 96 hits
441 하드웨어 인터럽트는 어떻게 감지할까요? [0] asdf 2025-03-01 12:06:29 89
asdf | 2025-03-01 12:06:29 | 89 hits
440 php 초보가 질문좀 드립니다. 새해 복 많이 받으세요 [0] 좆고딩 2025-03-01 10:33:07 103
좆고딩 | 2025-03-01 10:33:07 | 103 hits
439 횽들 pdf 하이퍼링크에 대해서 질문좀! [0] 횽들질문 2025-03-01 07:25:51 96
횽들질문 | 2025-03-01 07:25:51 | 96 hits