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

프로그래밍 >

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

프로그래밍 프로세스

스레드 작성
85 객체지향적으로 풀 수있는 알고리즘문제 좀 알려줘,,, [0] 도라에몽 2024-12-25 12:40:35 326
도라에몽 | 2024-12-25 12:40:35 | 326 hits
84 마이크로소프트 프로그램 [0] Times 2024-12-25 12:18:58 329
Times | 2024-12-25 12:18:58 | 329 hits
83 자바 질문 좀 [0] 수크라제 2024-12-25 11:36:47 339
수크라제 | 2024-12-25 11:36:47 | 339 hits
82 sh가 말한거 퇴근하고 게임하다가 만들긴함 [0] 북극레밍 2024-12-24 20:35:55 332
북극레밍 | 2024-12-24 20:35:55 | 332 hits
81 썸네일.db 는 뭐하는 파일인가요 ? [0] ddd 2024-12-24 20:14:46 322
ddd | 2024-12-24 20:14:46 | 322 hits
79 님들 정보보안가에 대한 전망 어떻게 생각하세요?? [0] 바라갸 2024-12-24 19:32:30 320
바라갸 | 2024-12-24 19:32:30 | 320 hits
78 ㅄ이 질문함. [0] 불고기브라더 2024-12-24 19:11:21 323
불고기브라더 | 2024-12-24 19:11:21 | 323 hits
77 si업체 노가다 코더들 수준이 어느 정도냐 [0] 2008 2024-12-24 18:29:09 301
2008 | 2024-12-24 18:29:09 | 301 hits
76 안드로이드 어플 하나 뜯어서 결제크랙 한번 만들어보려니까 도저히 모르겠다 [0] IlllllllllI 2024-12-24 18:08:01 323
IlllllllllI | 2024-12-24 18:08:01 | 323 hits
75 파이썬 루비 이딴거 좋아하는 새끼들은 자바충 보다도 못함 [0] 1 ㅁㄴㅇㄹ 2024-12-24 17:46:53 335
ㅁㄴㅇㄹ | 2024-12-24 17:46:53 | 335 hits
74 쿠팡 애자일 자바맨 >_< [0] 요미코번역인 2024-12-24 17:25:42 328
요미코번역인 | 2024-12-24 17:25:42 | 328 hits
73 결제크랙이 가능하긴 함? [1] 예비개발자 2024-12-24 17:04:34 310
예비개발자 | 2024-12-24 17:04:34 | 310 hits
72 이중에서 하나만 골라주라 [0] ㅇㅇ 2024-12-24 16:43:26 330
ㅇㅇ | 2024-12-24 16:43:26 | 330 hits
71 컴퓨터 관련한 직종중에 [0] 2024-12-24 16:22:17 326
| 2024-12-24 16:22:17 | 326 hits
70 오늘 자바랑 이클립스 깔았다 [0] ㅇㅇ 2024-12-24 16:01:09 306
ㅇㅇ | 2024-12-24 16:01:09 | 306 hits
69 2의 n승 재귀함수로 구하는건데 잘 짠거 맞음? [0] Dev님 2024-12-24 15:40:01 317
Dev님 | 2024-12-24 15:40:01 | 317 hits
68 밑에꺼 수정 [0] Dev님 2024-12-23 21:05:57 317
Dev님 | 2024-12-23 21:05:57 | 317 hits
67 고마워요 프갤 칭구들 [0] 1 Dev님 2024-12-23 20:44:47 308
Dev님 | 2024-12-23 20:44:47 | 308 hits
66 안드로이드는 왜 이런걸 안 만드나요 [0] 2024-12-23 20:23:39 340
| 2024-12-23 20:23:39 | 340 hits
65 상수 1 생성법. [0] 요미코치료사 2024-12-23 20:02:31 327
요미코치료사 | 2024-12-23 20:02:31 | 327 hits