按钮返回不适用于IE7

时间:2013-01-22 13:14:38

标签: php javascript html mysql internet-explorer-7

我有一个按钮预览的这个功能,这个代码适用于IE7中所有IE版本较少的版本。使用IE7的按钮不起作用。为什么?我该如何解决这个问题?

<?php    
//////// --- BUTTON BACK  : CHARGE THE QUERY OF BEFORE PAGE WHEN WE PRESS BACK ---/////////////    

 if ( isset($_POST['back'])){     

    $_SESSION['onpage']=$_SESSION['onpage']-1;

    $query_questionset= "select Q.Constructor AS Constructor,
                            QS.QuestionIDFKPK AS QuestionIDFKPK,
                            Q.QuestionValue AS QuestionValue,
                            QS.SortOrder AS SortOrder,
                            QS.onpage AS onpage
                         from tbluserset AS US
                         inner join tblquestionset AS QS ON 
                                 US.QuestionSetIDFKPK = QS.QuestionSetIDPK
                        inner join tblquestion AS Q ON 
                                 QS.QuestionIDFKPK = Q.QuestionIDPK
                        where (US.UserIDFKPK = ".$UserId.")
                         and (US.UserSetIDPK= '".$_SESSION['UserSetIDPK']."')
                         and (QS.onpage = '".$_SESSION['onpage']."')
                        order by QS.SortOrder";

    if($_SESSION['onpage']==0){         
        $_SESSION['controluserupdate']=1;

    }//<-END CASE ONPAGE=0
}//<- END POST [BACK]   

?>       

<script>    
function postBack() {    
                    var myForm = document.getElementById("formID");
                    var backInput = document.createElement("input");
                    backInput.type = "hidden";
                    backInput.name = "back";
                    backInput.value = "1";
                    myForm.appendChild(backInput);
};
</script>

< html>
 ..
 ....
< form id= "formID"  name="formID" class="formular"   method="post" action= "<?= $url = "QUESTIONAREFINISHING.php"; ?>" accept-charset="utf-8">


<div id="footer"> <!-- DIV FOOTER CONTAINER BUTTONS OUTSIDE BOX QUESTIONAIRE--> 
    <?php   if($_SESSION['onpage'] >=1 && $_SESSION['onpage'] <= $_SESSION['MaxOnPage']-1){ ?>          
        <div><button class="botonesform"  type="hidden"  onclick="postBack()" name="back"  value="" > &#8592 Back  </button ></div>             
        <input class="botonesform" type="submit" name="submit" onclick="probandosubmit()" value="Forward &#8594" />          
    <?php   } ?>

</div>
</form>
..
..
</html>

1 个答案:

答案 0 :(得分:-1)

抱歉,没有看到那里的完整代码。

您发布的JavaScript代码应该可以在IE7中运行,因此它可能是其他代码

你可以改变:

<input class="botonesform" type="submit" name="submit" onclick="probandosu...

<input class="botonesform" type="button" name="submit" onclick="probandosu...

(将类型从提交更改为按钮)。 然后查看单击它时IE7中是否存在任何脚本错误。如果没有,那么尝试在probandosubmit()中提交表单,看看是否解决了它。我看不到后退按钮提交任何内容,它只是尝试添加一个隐藏的文本输入,这应该在IE7中工作