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

프로그래밍 >

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

프로그래밍 프로세스

스레드 작성
504 에어로횽 여기서 정치적인 얘기하는 이유 솔직하게 듣고 싶은데. [0] 불고기브라더 2025-03-07 22:14:20 118
불고기브라더 | 2025-03-07 22:14:20 | 118 hits
503 디즈니랜드를 한국에 설립하려면 정부 지원금이 필요합니다 [0] 에어로홍 2025-03-07 20:40:42 137
에어로홍 | 2025-03-07 20:40:42 | 137 hits
501 웹땔깜은 무슨ㅋㅋㅋㅋ [0] 2025-03-07 12:53:29 94
| 2025-03-07 12:53:29 | 94 hits
500 수크라제는 지 아쉬울땐 존댓말 아니면 반말 [0] 2025-03-07 11:19:50 94
| 2025-03-07 11:19:50 | 94 hits
499 SQLITE가 빠르긴 빠르구나 [0] ㅇㅇ 2025-03-07 09:46:28 78
ㅇㅇ | 2025-03-07 09:46:28 | 78 hits
498 notepad.exe 프로세스 은폐하는 프로그램 삼,. [0] wef 2025-03-07 08:12:58 91
wef | 2025-03-07 08:12:58 | 91 hits
497 인민에어2 노트북 코딩할때 괜찮은가여? [0] 전문계 2025-03-07 05:06:18 93
전문계 | 2025-03-07 05:06:18 | 93 hits
496 시스템 프로그래밍은 뭐하는 과목이냐?? [0] 수크라제 2025-03-07 01:59:23 65
수크라제 | 2025-03-07 01:59:23 | 65 hits
495 인강 녹화가능한 프로그램이나 어플머임? [0] 인강 2025-03-07 00:25:53 82
인강 | 2025-03-07 00:25:53 | 82 hits
494 근데 SI만 병신인거냐>? [0] asdf 2025-03-06 22:52:28 78
asdf | 2025-03-06 22:52:28 | 78 hits
493 영상 재생시키려는데 [0] 컴맹 2025-03-06 21:18:51 86
컴맹 | 2025-03-06 21:18:51 | 86 hits
492 SQLITE 쓸데없다 [0] ㅇㅇ 2025-03-06 19:45:23 86
ㅇㅇ | 2025-03-06 19:45:23 | 86 hits
491 파이썬 사진 [0] 1 에어로홍 2025-03-06 18:11:59 134
에어로홍 | 2025-03-06 18:11:59 | 134 hits
490 PD수첩 인터뷰짤 보는데 SI 에서 일정만 중요하고 품질이 안중요함? [0] 허세강 2025-03-06 16:38:28 104
허세강 | 2025-03-06 16:38:28 | 104 hits
489 우회법이 나눠 보내는게 아니라 [0] 2025-03-06 13:31:31 105
| 2025-03-06 13:31:31 | 105 hits
488 크롬북에 우분투 올려서 C프로그래밍 할 수 있나? [0] 불고기브라더 2025-03-06 11:58:08 103
불고기브라더 | 2025-03-06 11:58:08 | 103 hits
487 미련한 중생글 답변해주셨던 분들 감사합니다... [0] ㅇㅇ 2025-03-06 10:24:39 80
ㅇㅇ | 2025-03-06 10:24:39 | 80 hits
486 님들 이런거 할 줄 아세요? [0] 2025-03-06 08:51:11 97
| 2025-03-06 08:51:11 | 97 hits
485 Django VS Ruby on Rails [0] ct 2025-03-06 04:10:30 109
ct | 2025-03-06 04:10:30 | 109 hits
484 개늅인데 c언어 질문점.. [0] 2025-03-06 02:36:54 77
| 2025-03-06 02:36:54 | 77 hits