我知道这个问题已经讨论了很多次。 我已经尝试了所有给出的答案,但没有成功。
在长形式内,其id =" imprim"和name =" imprim",我使用jQueryUI对话框让用户在要打印的项目之间进行选择,通过按钮打开。
第一次单击按钮时工作正常,但第二次显示叠加,页面冻结。
这里是我的jquery代码,在jQuery(document).ready(function($)
...
//init dialog
var $print = $('#items_toprint').dialog({
modal: true,
autoOpen: false,
resizable: false,
width: 500,
height: 500,
close: function() {
$(this).parent().appendTo("#imprim");
$('#items_toprint').dialog('close');
},
buttons: {
VALIDER: function(p) {
p.preventDefault();
$(this).parent().appendTo("#imprim");
$(this).dialog('close');
}}
});
//button action
$('#bttn_print').on("click", (function(e) {
e.preventDefault();
$print.dialog('open');
}));
});
和HTML(PHP生成)代码:
print '<form method="post" id="imprim" name="imprim" action="imprime.php">';
print '<div id="items_toprint" align="center" title = "Choix des graphes" style="display:none" >';
$sql1 = " SELECT p.id as criterid, p.code, p.libelle ";
$sql1.= " FROM " . MAIN_DB_PREFIX . "c_param as p ";
$sql1.= " WHERE p.active = 1";
$sql1.= " AND p.id IN (SELECT fk_parametre FROM " . MAIN_DB_PREFIX . 'patient_params WHERE fk_patient = ' . $patient->id . ")";
$sql1.= " order BY p.code";
$result1 = $db->query($sql1);
$num = $db->num_rows($resql);
if ($num >= 1) {
print '<table class="noborder" width="450px" align="center">';
$categ_encours = "";
$der_categ = "";
while ($row = mysqli_fetch_assoc($result1))
{
$categ_encours = $row[code];
if ($categ_encours != $der_categ)
{
print '<tr>';
print '<td width="300px" Style="color:#B40431" align= "center">';
print $categ_encours;
print '</td>';
print '<td>';
print ' ';
print '<td>';
print '</tr>';
$der_categ = $categ_encours;
}
print '<tr >';
print '<td width="300px" class="titre_noir" align= "right">';
print $row['libelle'];
print '</td>';
print '<td align= "left">';
print '<input type="checkbox" name ="graph_toprint[]" value="'.$row['criterid'].'" >';
print '</td>';
print '</tr>';
}
print '<tr>';
print '<td class="titre" align="center">';
print "Tableau paramètres";
print '</td>';
print '<td align="left">';
print '<input type="checkbox" name="tableau_param[]" value="t_param" CHECKED = "checked">';
print '</td>';
print '</tr>';
print '</table>';
}
else {
print '<p align="center" font-color="red" ><b>';
print "Vous ne suivez aucun critère pour ce patient !";
print '</b></p>';
}
print '</div>';
答案 0 :(得分:0)
创建一个带有名称的js函数PageEvents在document.ready()
中调用此函数class Match(models.Model):
team1 = models.ForeignKey('Team', related_name='team1')
team2 = models.ForeignKey('Team', related_name='team2')
tournament = models.ForeignKey(Tournament)
match_round = models.ForeignKey(Round)
team_1_hit = models.IntegerField(default=0)
team_2_hit = models.IntegerField(default=0)