2012-10-16 43 views
6

Tôi đã có ví dụ này từ 2 tháng và tôi đã thay đổi PC. Bây giờ điều này dường như không hoạt động nữa. Đây là một ví dụ mà nên tải một hộp thoại của cửa sổ nhỏ bằng (trước) đẩy một nút. Tuy nhiên, nó không hoạt động ... Đây là mã của tôi:

<html> 
<head> 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> 
    <script type="text/javascript"> 
// <---- VENTAÑAS DE PARAMETERES----> 

var regex,v,l,c,b; 
$("#wnd_Addparam").dialog({ 
      autoOpen: false, 
      height: 'auto', 
      width: 350, 
      modal: true, 
      resizable:false, 
      buttons: { 
       "Add": function() { 
           $(this).dialog("close"); 
            }, 
       Cancel: function() { 
        $(this).dialog("close"); 
       } 
      }, 
      close: function() { 
       $(this).dialog("close"); 
      } 
     }); 

     $("#btn_Addpar").click(function() { 
       $("#wnd_Addparam").dialog("open"); 
      }); 
$("#wnd_Paramedit").dialog({ 
      autoOpen: false, 
      height: 'auto', 
      width: 350, 
      modal: true, 
      resizable:false, 
      buttons: { 
       "Accept": function() { 
         $(this).dialog("close"); 

       }, 
       Cancel: function() { 
        $(this).dialog("close"); 
       } 
      }, 
      close: function() { 
       $(this).dialog("close"); 
      } 
     }); 

     $("#btn_Pedit").click(function() { 
       $("#wnd_Paramedit").dialog("open"); 
      }); 
$("#wnd_Borpara").dialog({ 
      autoOpen: false, 
      height: 'auto', 
      width: 300, 
      resizable:false, 
      modal: true, 
      buttons: { 
       "Accept": function() { 
        $(this).dialog("close"); 

       }, 
       Cancel: function() { 
        $(this).dialog("close"); 
       } 
      }, 
      close: function() { 
       $(this).dialog("close"); 
      } 
     }); 

     $("#btn_Deletepara").click(function() { 
       $("#wnd_Borpara").dialog("open"); 
      }); 

</script></head> 
<!--<form method="POST" id="iformp" name="nformp">--> 
<body> 
<h3>List of parameters</h3> 
<div id="sortparam" > 
</div> 
<input type="button" id="btn_Addpar" value="Add"/> 
<input type="button" id="btn_Deletepara" value="Delete"/> 
<input type="button" id="btn_Pedit" value="Edit"/> 
<!--<form>--> 

</body> 

</html> 

hãy .. Tại sao tôi không có một lỗi cho hộp thoại ???

Trả lời

1
Now use this code simple.... 


<html> 
    <head> 
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> 
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js"></script> 
    <script type="text/javascript"> 
    // <---- VENTAÑAS DE PARAMETERES----> 
    $(document).ready(function() { 
    var regex,v,l,c,b; 
    $("#wnd_Addparam").dialog({ 
       autoOpen: false, 
       height: 'auto', 
       width: 350, 
       modal: true, 
       resizable:false, 
       buttons: { 
        "Add": function() { 
            $(this).dialog("close"); 
             }, 
        Cancel: function() { 
         $(this).dialog("close"); 
        } 
       }, 
       close: function() { 
        $(this).dialog("close"); 
       } 
      }); 

      $("#btn_Addpar").click(function() { 
        $("#wnd_Addparam").dialog("open"); 
       }); 

    }); 
    </script> 
    </head> 
    <!--<form method="POST" id="iformp" name="nformp">--> 
    <body> 
    <h3>List of parameters</h3> 
    <div id="sortparam" > 
    </div> 
    <input type="button" id="btn_Addpar" value="Add"/> 

    <!--<form>--> 

    </body> 

    </html> 
4

Bạn đang tham chiếu lõi jQuery, nhưng không phải chính jQuery UI.

Tôi tin rằng dialog chức năng chỉ tồn tại trong jQuery UI, vì vậy bạn sẽ cần phải thêm dòng sau vào trang của bạn quá:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> 
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js"></script> 

<script type="text/javascript"> 
// <---- VENTAÑAS DE PARAMETERES----> 
$(document).ready(function() { 
    var regex,v,l,c,b; 
    $("#wnd_Addparam").dialog({ 
     // Your code... 
} 
+1

Nhưng với thư viện này tôi có một lỗi nhiều hơn hoặc nhiều nhất vì tôi có điều này: ReferenceError: Không thể tìm thấy biến: jQuery trong câu số 5 –

+1

Và không hoạt động ... –

+1

Bạn cần đặt kịch bản lệnh jQuery UI sau tập lệnh jQuery - Tôi sẽ làm ví dụ của tôi rõ ràng ... – Fenton

2

tôi đã cùng một vấn đề. Tôi bao gồm jQuery hai lần trên cùng một trang web (jQuery sau đó jQuery UI sau đó jQuery, và nó gây ra cho tôi khó khăn (chính xác cùng một vấn đề trên .dialog)

Các vấn đề liên quan