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();関数から呼び出されるクリック[]でも同じです。

それについて何か提案はありますか?

4

1 に答える 1

0

preventDefault()送信クリックが必要です。これで、ページがリロードされるか、変更されます。

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