0

我正在做的是调用一个函数,该函数passval()本身正在调用另一个menu()显示颜色框 iframe 的函数:

<html>
<head>
<link rel="stylesheet" href="colorbox/colorbox.css" />
<script src="js/jquery.min.js"></script>
<script src="colorbox/jquery.colorbox.js"></script>
<script>
            $(document).ready(function(){
                //Examples of how to assign the ColorBox event to elements
                
                $(".group3").colorbox({rel:'group3', transition:"none", width:"75%", height:"75%"});
                $(".inline").colorbox({inline:true, width:"40%"});
                $(".iframe").colorbox({iframe:true, width:"90%", height:"80%"});
                            
            });
            </script>


    <script type="text/javascript">
    function passval()
    {
    
    var vc = document.getElementById('vc').value;
    var fc = document.getElementById('fc').value;
    //checking inputs
    //document.write(fc+" ");
    //document.write(vc+" ");
    //document.getElementById('inline').click();
    menu();
    }
    function menu() 
    {
      $('<a />').colorbox({fixedWidth:"500px", fixedHeight:"300px", iframe:true, href:"search.php", bgOpacity:0, open:true}); return false;
     }
    
    </head>
    <body>
    <form id="form1" name="form1" method="post">
    <input type="submit" value="Submit" onclick="passval()" />
    </form>
    <a class='iframe' id="inline" href="chart.htm">iFrame</a>
    </body>
    </html>

但是它一打开就打开和关闭..document.getElementById('inline').click();函数调用的 click [ ] 也是如此

有什么建议吗?

4

1 回答 1

0

您需要preventDefault()点击提交。现在您的页面已重新加载或更改:

<input type="button" value="Submit" onclick="passval()" />
于 2012-11-12T15:42:24.347 回答