我有一个弹出提交表单,一旦我提交它,应该使用window.load方法将弹出窗口加载到我当前窗口。问题是我总是被重定向到那个窗口(imag_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>
答案 0 :(得分: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>
答案 1 :(得分:0)
你没有调用poponload
函数!将其放在body
标记中。
<body onload="poponload()">