print popup jquery对话框

时间:2014-08-18 04:26:11

标签: javascript jquery codeigniter

我需要打印弹出对话框。我已经尝试了几次,但是我可以通过弹出对话框获得整个窗口。我只需要打印对话框。不是对话框的内容。

这是我的代码

查看

<script type="text/javascript">
$(document).ready(function(){

$("#dialogbox").dialog({
     autoOpen:false,
     modal:true,
     title: "NDB BANK",
     width:950,
     height:300,
     open: function( event, ui ) {
     }
 });

$('#submit').click(function() {
     $('#dialogbox').empty()
     var $clone=$("#show").clone()
     $('#dialogbox').append($clone)
     $('#dialogbox').append("<input type='button' id='submit2' value='save'  onclick='myFunction2()'></input>")
     $('#dialogbox').append("<input type='button' id='print' value='print'  onclick='printFunction()'></input>")
     $("#dialogbox :input").prop("disabled", true);
     $("#dialogbox #submit2").prop("disabled", false);
     $("#dialogbox #print").prop("disabled", false);
     $("#dialogbox #amount_in_words").val($('#amount_in_words').val());
     $('#dialogbox').dialog('open');
 });            
})
</script>

<script>
function printFunction() {
window.print();
}
</script>

<div id="dialogbox" style="height: 200px ; width: 400px; background-color: #FFA375">  </div>   
<div id="content">
<div id="show">
<form action="#" id="cheque_details" name="cheque_details" method="post">
    <div id="nameDiv"><p id="namecont">name: <input type="text" id="name"/></p> </div>
    <div id="dateDiv"><p id="date">Date: <input type="text" id="datepicker"/></p></div>
    <div id="amountDiv"><p>Amount: <input type="text" id="amount"  onkeyup="myFunction()" /></p></div>
    <div id="letAmountDiv"><p>Amount In letters:<textarea id="amount_in_words" rows="3"  cols="30"></textarea></p></div>
    <p id="addresscont">address: <input type="text" id="address"/></p>
    <p id="acccont">Account No: <input type="text" id="acc_no"/></p>
    <p id="bank_name">Bank: <input type="text" id="bank"/></p>
</form>
</div>

0 个答案:

没有答案