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

프로그래밍 >

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

프로그래밍 프로세스

스레드 작성
64 형들 프로그래밍 공부 뭐부터 하면 좋을까? [0] 카운터블 2024-12-23 19:41:22 369
카운터블 | 2024-12-23 19:41:22 | 369 hits
63 헤더파일에 대해 설명해주는건 어떤 분야인가요? [0] 카운터블 2024-12-23 19:20:14 312
카운터블 | 2024-12-23 19:20:14 | 312 hits
62 하드웨어를 사용 중이라는 거는 무슨 말이냐??? [0] 수크라제 2024-12-23 18:59:05 354
수크라제 | 2024-12-23 18:59:05 | 354 hits
61 단방향 암호화하면 암호로부터 원래 단어 유추 불가능하냐?? [0] 수크라제 2024-12-23 18:16:52 333
수크라제 | 2024-12-23 18:16:52 | 333 hits
60 Si 개발자가 프로젝트를 끝내고 맞은 주말 [0] 북극레밍 2024-12-23 17:55:38 334
북극레밍 | 2024-12-23 17:55:38 | 334 hits
59 와인 마시고 왔는데 흐음 .. [0] 북극레밍 2024-12-23 17:34:28 334
북극레밍 | 2024-12-23 17:34:28 | 334 hits
58 Django VS Ruby on Rails? [0] ct 2024-12-23 17:13:20 344
ct | 2024-12-23 17:13:20 | 344 hits
57 컴파일 언어가 스크립트 언어보다 성능 제외히고 나은게 뭐가 있죠? [0] 2024-12-23 16:51:43 339
| 2024-12-23 16:51:43 | 339 hits
56 삼들삼들 [0] ㅅㄷ 2024-12-23 16:09:31 345
ㅅㄷ | 2024-12-23 16:09:31 | 345 hits
55 웹 프로그래밍 질문좀 [0] 123 2024-12-23 15:06:16 344
123 | 2024-12-23 15:06:16 | 344 hits
54 역시 밤샘은 영 좋지 않아 [0] 프갤럼 2024-12-23 14:45:08 378
프갤럼 | 2024-12-23 14:45:08 | 378 hits
53 SQLITE 빠르다는게 사실이냐 [0] ㅇㅇ 2024-12-23 12:30:14 326
ㅇㅇ | 2024-12-23 12:30:14 | 326 hits
52 플밍갤 고수님들 윈도우 xp 숨김폴더 보는방법좀 알려주세요. [0] ㅇㅇ 2024-12-23 12:09:06 348
ㅇㅇ | 2024-12-23 12:09:06 | 348 hits
51 자바는 웹서핑하다가 자바머신 업데이트 하라고 뜰때가 제일 병신같지않냐 [0] ㅇㅇ 2024-12-23 12:07:41 327
ㅇㅇ | 2024-12-23 12:07:41 | 327 hits
50 병신인걸 뭐라 하진 않겠는데 [0] ㅇㅇ 2024-12-23 12:00:40 317
ㅇㅇ | 2024-12-23 12:00:40 | 317 hits
49 프,로그래머 대학 학벌이 중요한가요??? [0] 칸다봊 2024-12-23 11:41:21 317
칸다봊 | 2024-12-23 11:41:21 | 317 hits
48 웹사이트 만드려면 뭐 공부해야되죠? [0] 프래맹 2024-12-23 11:29:37 319
프래맹 | 2024-12-23 11:29:37 | 319 hits
46 오늘 새벽 5시에 PowerVR SDK설치하고 [0] 북극레밍 2024-12-23 11:11:27 326
북극레밍 | 2024-12-23 11:11:27 | 326 hits
45 혹시 너네중에 [0] 노비 2024-12-23 10:48:53 316
노비 | 2024-12-23 10:48:53 | 316 hits
43 학원 고졸 출신 경력 3년차 이직 현재연봉 3500 [0] 플밍 2024-12-23 09:45:31 341
플밍 | 2024-12-23 09:45:31 | 341 hits