2012-11-12 4 views
0

열립니다로 즉시 종료 내가 뭘이 기능 passval()를 호출하고있는 중이 자체가 colorbox은 iframe을는 함수 호출로 Colorbox를 호출하지만

<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> 

그러나이 열립니다를 표시하고 즉시 닫고 다른 함수 menu()를 호출된다 그것이 열렸습니다 .. 동일한 기능을 호출하여 [document.getElementById('inline').click();]를 클릭하십시오.

어떤 제안 사항이 있습니까?

답변

0

제출 클릭시 preventDefault()이 필요합니다. 이제 페이지가 다시로드되거나 변경됩니다.

<input type="button" value="Submit" onclick="passval()" /> 
+0

오 젠장! 바보 같은 실수들 '''을''button "'' @ webdeveloper에 많이 바 꾸었습니다. :) –

관련 문제