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

프로그래밍 >

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

프로그래밍 프로세스

스레드 작성
483 정수정한테 해킹 좀 배웠으면 좋겠다 [0] 1 에어로홍 2025-03-06 01:03:15 124
에어로홍 | 2025-03-06 01:03:15 | 124 hits
482 코딩용노트북 화면크기는 몇인치가 적당? [0] dd 2025-03-05 23:29:41 103
dd | 2025-03-05 23:29:41 | 103 hits
481 웹 땔깜? [0] Pro1 2025-03-05 21:55:58 101
Pro1 | 2025-03-05 21:55:58 | 101 hits
480 파이썬 강좌, 책, 문서 모음 [0] ㅇㅇ 2025-03-05 17:16:03 129
ㅇㅇ | 2025-03-05 17:16:03 | 129 hits
479 프로그래밍 언어 벤치마크 게임 [0] ㅇㅇ 2025-03-05 15:42:31 94
ㅇㅇ | 2025-03-05 15:42:31 | 94 hits
478 프로그래밍 언어 벤치마크 사이트 모음 [0] ㅇㅇ 2025-03-05 14:09:04 77
ㅇㅇ | 2025-03-05 14:09:04 | 77 hits
477 J라는 언어 대단하네요 [0] 2025-03-05 12:35:21 82
| 2025-03-05 12:35:21 | 82 hits
474 루비가 좋긴 하다만 파이썬에 비할바는 아니지,..... [0] 씹죶 2025-03-05 07:53:57 97
씹죶 | 2025-03-05 07:53:57 | 97 hits
473 이거 너무 좋다. [0] 黑猫 2025-03-05 06:20:27 93
黑猫 | 2025-03-05 06:20:27 | 93 hits
471 전세계 거의 모든 프로그래머가 공감하는 것 [0] 2025-03-05 00:05:55 96
| 2025-03-05 00:05:55 | 96 hits
470 루비 나오는 드라마도 있는데 [0] 에어로홍 2025-03-04 22:32:18 91
에어로홍 | 2025-03-04 22:32:18 | 91 hits
469 웹 레벨은 보시오. [0] ㅁㄴㅇㄹ 2025-03-04 20:58:54 101
ㅁㄴㅇㄹ | 2025-03-04 20:58:54 | 101 hits
468 언어로 갑론을박하는 놈들 보면 [0] dd 2025-03-04 19:25:32 107
dd | 2025-03-04 19:25:32 | 107 hits
465 여기 왜이리 웹 차별이 심하죠? [0] 2025-03-04 14:44:39 124
| 2025-03-04 14:44:39 | 124 hits
464 ㅁㅊ 월급200도 안되는 새끼들이 언어가지고 싸우고있네. [0] ㄷㄱ 2025-03-04 13:11:04 107
ㄷㄱ | 2025-03-04 13:11:04 | 107 hits
463 웹은 디자이너라고 붙일 가치도 없다 [0] dd 2025-03-04 11:37:34 116
dd | 2025-03-04 11:37:34 | 116 hits
462 Ruby 웹언어랍니다 글 전부 내려주세요. [0] ㅁㄴㅇㄹ 2025-03-04 08:30:42 112
ㅁㄴㅇㄹ | 2025-03-04 08:30:42 | 112 hits
461 루비 같은 언어 쓰고싶다 [0] ㅁㄴㅇㄹ 2025-03-04 06:57:09 78
ㅁㄴㅇㄹ | 2025-03-04 06:57:09 | 78 hits
460 엥? 루비 완전 웹언어 아니야? [0] ㅁㄴㅇㄻㄴㅇ 2025-03-04 05:23:43 119
ㅁㄴㅇㄻㄴㅇ | 2025-03-04 05:23:43 | 119 hits
459 야 근데 루비는 [0] ct 2025-03-04 03:50:12 115
ct | 2025-03-04 03:50:12 | 115 hits