0

我有一个弹出提交表单,一旦我提交它应该使用 window.load 方法将弹出窗口加载到我的当前窗口中。问题是我总是被重定向到那个窗口(imagine_decupare.php),而不是让那个窗口作为弹出窗口加载到我当前的窗口中。关于为什么的任何想法?

function hide_popup(id){
            if (document.getElementById){
                obj = document.getElementById(id);
                if (obj.style.display == ""){
                        obj.style.display = "none";
                }
            }
    }

    function poponload(){
            testwindow = window.open("decupare_imagine.php","mywindow","location=0,status=1,scrollbars=1,width=100,height=100");
            testwindow.moveTo(0, 0);
        }

    <form action="decupare_imagine.php" method="post" >
                                                        <input type="text" name="alt-rol" value="<?php echo $data[1];?>" style="display:none;" /> 

                                                        <a href="javascript:hide_popup('my_popup<?=$data[1]?>')"  style="width:5%;float:left;margin: 0 0 0 90%"><img src="../images/icon_error.gif"> </a>
                                                        <div class="radio_pop">
                                                        //some data to be sent      
                                                        </div>
                                                        <input type="submit" value="Tip imagine" class="buton_imagine" onclick="javascript:hide_popup('my_popup<?=$data[1]?>');" onsubmit="javascript: poponload()" style="width:100%;float:left;" />
    </form>
4

2 回答 2

1

而不是像这样在输入上添加 onsubmit :

<input type="submit" value="Tip imagine" class="buton_imagine"  
 onclick="javascript:hide_popup('my_popup<?=$data[1]?>');" 
 onsubmit="javascript: poponload()" style="width:100%;float:left;" />
</form>

改为填写表格

<form action="decupare_imagine.php" method="post" 
onsubmit="javascript: poponload()">....</form>
于 2013-02-19T08:08:51.437 回答
0

你没有调用poponload函数!把这个放在body标签里。

<body onload="poponload()">
于 2013-02-19T08:03:33.847 回答