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

프로그래밍 >

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

프로그래밍 프로세스

스레드 작성
416 해킹이 일어나는 이유가 근본적으로 api땜이지않냐 [0] ㅇㅇㅇ 2025-02-27 03:59:33 143
ㅇㅇㅇ | 2025-02-27 03:59:33 | 143 hits
415 모바일도 결국 웹으로 대동단결될걸 [0] ㄴㄴ 2025-02-27 02:25:56 139
ㄴㄴ | 2025-02-27 02:25:56 | 139 hits
414 테트리스 만들기 8일차 및 연휴 테트리스 만들기 계획 [0] 매직개더링 2025-02-27 00:52:26 109
매직개더링 | 2025-02-27 00:52:26 | 109 hits
413 it회사도 축구장같지않냐?.txt [0] ㅇㅇㅇ 2025-02-26 23:18:48 153
ㅇㅇㅇ | 2025-02-26 23:18:48 | 153 hits
412 웹들웹들 웹땔감들아 [0] 프갤럼 2025-02-26 20:12:05 148
프갤럼 | 2025-02-26 20:12:05 | 148 hits
411 스트리밍 이미지 테스트 - 수정 [0] 프갤럼 2025-02-26 18:38:23 119
프갤럼 | 2025-02-26 18:38:23 | 119 hits
409 VBA언어 배울수 있는곳 있나요? [0] ㄹㅇ 2025-02-26 18:07:06 147
ㄹㅇ | 2025-02-26 18:07:06 | 147 hits
408 너무급해서 올려봅니다 [0] 너무급해서 2025-02-26 18:05:06 133
너무급해서 | 2025-02-26 18:05:06 | 133 hits
407 커널 드라이버 개발자 전망이 어떠냐???? [0] ㅁㄴ 2025-02-26 18:02:58 130
ㅁㄴ | 2025-02-26 18:02:58 | 130 hits
406 한자(黑猫)형님 [0] 불쌍한백수 2025-02-26 17:57:51 108
불쌍한백수 | 2025-02-26 17:57:51 | 108 hits
405 한자(黑猫)님 질문할께여(안건방짐) [0] 불쌍한백수 2025-02-26 17:55:25 137
불쌍한백수 | 2025-02-26 17:55:25 | 137 hits
404 해커만 봐라 다른 새끼는 보면 뒤진다그냥 [0] 불쌍한백수 2025-02-26 17:49:55 148
불쌍한백수 | 2025-02-26 17:49:55 | 148 hits
403 횽들 C로 쓴 자료구조론 1판을 샀거든? [0] 잣빱 2025-02-26 17:46:17 134
잣빱 | 2025-02-26 17:46:17 | 134 hits
402 콜백함수를 우리말로 하면 나가요 함수 아니냐? [0] ㅇㅇ 2025-02-26 17:40:31 160
ㅇㅇ | 2025-02-26 17:40:31 | 160 hits
401 최근 금융권 보안문제에 대해 [0] 낸시랭 2025-02-26 17:36:08 164
낸시랭 | 2025-02-26 17:36:08 | 164 hits
400 웹으로 앱을만들면 [0] 졸작만들어야되 2025-02-26 17:24:59 148
졸작만들어야되 | 2025-02-26 17:24:59 | 148 hits
399 Django VS Ruby on Rails [0] awdaw 2025-02-26 17:23:03 147
awdaw | 2025-02-26 17:23:03 | 147 hits
398 컴터가 갑자기 안대는데 도와주셈 [0] Elsa 2025-02-26 17:19:07 115
Elsa | 2025-02-26 17:19:07 | 115 hits
397 맥북프로15랑 싱크패드 t440s 중에 뭐가 나을까여 [0] WOF 2025-02-26 17:17:11 100
WOF | 2025-02-26 17:17:11 | 100 hits
396 평소에 내가 방에서 불끄고 컴퓨터하는데 [0] 아빠는누워있다 2025-02-26 17:15:07 144
아빠는누워있다 | 2025-02-26 17:15:07 | 144 hits