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

프로그래밍 >

450 자바스크립트 질문좀(글 제대로 수정함) ㅇㅇ 2025-03-02 05:16:03 121
ㅇㅇ | 2025-03-02 05:16:03 | 121 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
목록 수정  삭제
목록 수정 삭제

프로그래밍 프로세스

스레드 작성
452 당신의 뒷조사를 할때 사용되는 안드로이드폰(맛폰으로 보세요, 엑박이면 X표시를 클릭) [0] ㅇㅇ 2025-03-03 16:55:32 117
ㅇㅇ | 2025-03-03 16:55:32 | 117 hits
451 자바 스레드 동기화 쩌네 [0] 수크라제 2025-03-02 09:56:21 145
수크라제 | 2025-03-02 09:56:21 | 145 hits
450 자바스크립트 질문좀(글 제대로 수정함) [0] ㅇㅇ 2025-03-02 05:16:03 121
ㅇㅇ | 2025-03-02 05:16:03 | 121 hits
449 Ruby가 좋은 이유를 코드로 설명.ruby [0] ㅇㅇ 2025-03-02 03:42:33 183
ㅇㅇ | 2025-03-02 03:42:33 | 183 hits
448 안드로이드로 제작된 앱 JSP서버로 포팅하려면 얼마나 걸려? [0] Reinvert 2025-03-02 02:08:59 156
Reinvert | 2025-03-02 02:08:59 | 156 hits
447 나도 수학잘해서 학창시절에 칭찬받고싶었는데 [0] ㅇㅇ 2025-03-01 23:01:50 173
ㅇㅇ | 2025-03-01 23:01:50 | 173 hits
446 C++ 질문하나 하자 [0] ㅁㄴㅇㄹ 2025-03-01 21:28:14 192
ㅁㄴㅇㄹ | 2025-03-01 21:28:14 | 192 hits
445 나두 카톡봇같은거나 간단한 2d게임만들고싶은뎅 뭐부터할까 [0] ㅂㄷㄱㅋㅇㄹ 2025-03-01 18:20:44 160
ㅂㄷㄱㅋㅇㄹ | 2025-03-01 18:20:44 | 160 hits
444 이길로 들어선게 너무 후회된다.SSUL [0] 자바는사람잡아 2025-03-01 16:47:14 149
자바는사람잡아 | 2025-03-01 16:47:14 | 149 hits
443 프리랜서로 월천찍을라면 얼마나 잘해야되요? [0] ㅇㅇ 2025-03-01 15:13:28 155
ㅇㅇ | 2025-03-01 15:13:28 | 155 hits
442 형들.. 제발 도움좀 부탁해 [0] ㅇㅇ 2025-03-01 13:39:49 145
ㅇㅇ | 2025-03-01 13:39:49 | 145 hits
441 하드웨어 인터럽트는 어떻게 감지할까요? [0] asdf 2025-03-01 12:06:29 143
asdf | 2025-03-01 12:06:29 | 143 hits
440 php 초보가 질문좀 드립니다. 새해 복 많이 받으세요 [0] 좆고딩 2025-03-01 10:33:07 159
좆고딩 | 2025-03-01 10:33:07 | 159 hits
439 횽들 pdf 하이퍼링크에 대해서 질문좀! [0] 횽들질문 2025-03-01 07:25:51 157
횽들질문 | 2025-03-01 07:25:51 | 157 hits
438 당신의 뒷조사를 할때 사용되는 안드로이드폰(맛폰으로 보세요, 엑박이면 X표시를 클릭) [0] ㅇㅇ 2025-03-01 04:18:41 139
ㅇㅇ | 2025-03-01 04:18:41 | 139 hits
437 c++문자열때문에 너무 재밌다 [0] ㅇㅇ 2025-03-01 01:11:31 178
ㅇㅇ | 2025-03-01 01:11:31 | 178 hits
436 C++앰창언어 쓰면서 Ruby 라이브러리가 병신이라고 하는놈들 소ㅡ름;; [0] ㅇㅇ 2025-02-28 23:37:57 185
ㅇㅇ | 2025-02-28 23:37:57 | 185 hits
435 어제밤 일기 [0] 서정코더 2025-02-28 22:04:17 185
서정코더 | 2025-02-28 22:04:17 | 185 hits
434 안드로이드 3d온라인게임 만들려면 뭐뭐배워야하나요? [0] dd 2025-02-28 20:30:49 149
dd | 2025-02-28 20:30:49 | 149 hits
433 야 근데 p대 np문제에서 [0] ㅇㅇ 2025-02-28 18:57:03 161
ㅇㅇ | 2025-02-28 18:57:03 | 161 hits