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

프로그래밍 >

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

프로그래밍 프로세스

스레드 작성
565 자바스크립트 초보 질문점 [0] TNAMANIA 2025-03-13 06:10:46 36
TNAMANIA | 2025-03-13 06:10:46 | 36 hits
564 빡쳐서 학생증 찍어서 보냈다 [0] Dev님 2025-03-13 04:36:31 64
Dev님 | 2025-03-13 04:36:31 | 64 hits
563 sns같은 아이디어 [0] dlsgh1628 2025-03-13 03:02:01 60
dlsgh1628 | 2025-03-13 03:02:01 | 60 hits
562 https://www.facebook.com/edwards.june.9 [0] 에어로홍 2025-03-13 01:26:57 33
에어로홍 | 2025-03-13 01:26:57 | 33 hits
561 영어공부가 프로그래밍공부보다는 훨재밌지 [0] 길동 2025-03-12 22:19:51 53
길동 | 2025-03-12 22:19:51 | 53 hits
560 아나 드림즈파크 인증어케해 [0] Dev님 2025-03-12 17:37:40 40
Dev님 | 2025-03-12 17:37:40 | 40 hits
559 VS 2013 32bit 랑 32bit web installer 는 뭐가 [0] Dev님 2025-03-12 14:29:52 30
Dev님 | 2025-03-12 14:29:52 | 30 hits
558 비주얼스튜디오2013 어디서 다운받아? [0] Dev님 2025-03-12 12:56:23 39
Dev님 | 2025-03-12 12:56:23 | 39 hits
557 C++) C++충이지만 자바 Http연결부분은 잘만든게 확실합니다. [0] ㅇㅇ 2025-03-12 11:22:47 52
ㅇㅇ | 2025-03-12 11:22:47 | 52 hits
556 월 250만, 중식제공 찾기가 존내 힘들다 [0] ㅁㄹ 2025-03-12 08:16:17 39
ㅁㄹ | 2025-03-12 08:16:17 | 39 hits
555 공부처음 시작하려면 뭐부터 공부해야됨?? [0] 희사마긔여워 2025-03-12 06:42:44 42
희사마긔여워 | 2025-03-12 06:42:44 | 42 hits
554 디자인 하는 애들이 OpenGL 배워도 아무짝에도 쓸데 없나여? [0] 스마트븅신 2025-03-12 05:09:05 83
스마트븅신 | 2025-03-12 05:09:05 | 83 hits
553 데이터베이스 만들때 데이터를 일일히 다 입력해야 됨? [0] ㅇㅇ 2025-03-12 02:01:32 61
ㅇㅇ | 2025-03-12 02:01:32 | 61 hits
552 웹 플머 형들 [0] 스프링 2025-03-12 00:28:03 26
스프링 | 2025-03-12 00:28:03 | 26 hits
551 컹커러처럼 탭을 분할시키는 브라우저 없음? [0] asd 2025-03-11 22:54:28 75
asd | 2025-03-11 22:54:28 | 75 hits
550 프갤러들아 올해는 취직해야지? [0] 프갤영감 2025-03-11 19:47:21 25
프갤영감 | 2025-03-11 19:47:21 | 25 hits
549 정치놀음은 니들끼리 해라 [0] ㅇㅇ 2025-03-11 18:13:37 24
ㅇㅇ | 2025-03-11 18:13:37 | 24 hits
548 c배우고잇는데 질문점 [0] 니헵 2025-03-11 15:06:50 65
니헵 | 2025-03-11 15:06:50 | 65 hits
547 데이터베이스를 구축하고 싶어요 [0] ㅇㅇ 2025-03-11 11:59:46 33
ㅇㅇ | 2025-03-11 11:59:46 | 33 hits
546 근데막상 대학안가도 고졸할새끼는업음 [0] ㅇㅇ 2025-03-11 08:52:52 91
ㅇㅇ | 2025-03-11 08:52:52 | 91 hits