单击链接时,它应该会在单击稍后下载按钮时弹出对话框,它会切换按钮的选中变量。然后关闭对话框按钮
我是 Javascript 和 Jquery 的新手,不知道我在做什么
$(function download_box(checkbox) {
// a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
$( "#opener" ).click(function() {
$( "#dialog-download" ).dialog( "open" );
return false;
});
$( "#dialog-download" ).dialog({
autoOpen: false,
resizable: false,
height:140,
width:325,
modal: true,
buttons: {
"Download Now": function() {
var mycheckbox1 = document.getElementById(checkbox);
if(mycheckbox1.checked){
box.checked=false;
}
else{
box.checked=true;
}
$( this ).dialog( "close" );
},
"Download Later": function() {
$('#c2').prop("checked", true);
$( this ).dialog( "close" );
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
});
});
<form method="post" action="<?php echo $PHP_SELF;?>">
<a id="opener" href="#" OnClick="download_box('#c1')">db1.csv:</a>
<input id="c1" type="checkbox" name="download[]" value="db1.csv" />
<!-- ... -->
<input type="submit" value="submit" name="submit">
</form>