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

프로그래밍 >

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

프로그래밍 프로세스

스레드 작성
109 니네 혹시 전산직 공무원 준비하는 새끼들있냐? [0] dd 2024-12-27 12:43:10 290
dd | 2024-12-27 12:43:10 | 290 hits
107 대학생도 할 수 있는 프로그래밍 알바 [0] ㅋㅁ 2024-12-25 22:12:27 284
ㅋㅁ | 2024-12-25 22:12:27 | 284 hits
105 공비야 넌 프로그래밍 독학으로 공부한거냐??? [0] 수크라제 2024-12-25 21:29:41 302
수크라제 | 2024-12-25 21:29:41 | 302 hits
104 근데 사실 지잡대에 똑똑한 애들 많다고 하더라 [0] ㅇㅇ 2024-12-25 21:08:33 288
ㅇㅇ | 2024-12-25 21:08:33 | 288 hits
102 너네 좋아하던 게임 서비스종료하면 다시만드냐? [0] ㅇㅇ 2024-12-25 20:04:43 287
ㅇㅇ | 2024-12-25 20:04:43 | 287 hits
101 리버싱 질문 좀 [0] 수크라제 2024-12-25 19:43:34 285
수크라제 | 2024-12-25 19:43:34 | 285 hits
100 자바스크립트 고수님들 팝업창에 대한 문제좀 해결해주셈 ㅜㅜ [0] ㅇㅇ 2024-12-25 19:21:56 315
ㅇㅇ | 2024-12-25 19:21:56 | 315 hits
99 스틸그레이팅단위중량 에 대하여 정보추천 [0] ㅇㅇ 2024-12-25 19:00:47 282
ㅇㅇ | 2024-12-25 19:00:47 | 282 hits
98 아 아래질문에 추가로 [0] dd 2024-12-25 18:39:38 282
dd | 2024-12-25 18:39:38 | 282 hits
97 솔직히 Ruby만큼 완벽한 언어를 본적이 없다. [0] ddd 2024-12-25 18:18:29 292
ddd | 2024-12-25 18:18:29 | 292 hits
96 리버싱 핵심원리 공부 해야되냐??? [0] 수크라제 2024-12-25 17:57:21 288
수크라제 | 2024-12-25 17:57:21 | 288 hits
95 진짜 실력 없으면 중소기업도 취직 힘드냐??? [0] 1111 2024-12-25 17:36:13 283
1111 | 2024-12-25 17:36:13 | 283 hits
94 존나유치한질문이긴한데 [1] 데헷 2024-12-25 17:15:05 313
데헷 | 2024-12-25 17:15:05 | 313 hits
93 C언어나 자바로 수십줄이 걸릴걸 Ruby는 단 한줄이면 됩니다 ^^ [0] ㅇㅇ 2024-12-25 16:53:57 333
ㅇㅇ | 2024-12-25 16:53:57 | 333 hits
91 웹겜 만들때 php jsp 어떤걸 더 선호함?? [0] player 2024-12-25 16:11:40 306
player | 2024-12-25 16:11:40 | 306 hits
90 C를 첫 언어로 하는 이유는 있지않나? [1] CodingSlave 2024-12-25 15:50:32 302
CodingSlave | 2024-12-25 15:50:32 | 302 hits
89 1부터 10000까지의 숫자를 셀 때 4의 배수를 구하시오 [0] 1 도라에몽 2024-12-25 15:29:24 308
도라에몽 | 2024-12-25 15:29:24 | 308 hits
88 웹형들 [1] Pro1 2024-12-25 14:26:09 314
Pro1 | 2024-12-25 14:26:09 | 314 hits
87 π = asin(0.5)*6 [0] 요미코번역인 2024-12-25 13:22:55 295
요미코번역인 | 2024-12-25 13:22:55 | 295 hits
86 형식언어와 오타마타 [0] ksy 2024-12-25 13:01:43 313
ksy | 2024-12-25 13:01:43 | 313 hits