Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/474.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用jquery或javascript打印带有图像和内容的优惠券_Javascript_Jquery_Css_Image - Fatal编程技术网

用jquery或javascript打印带有图像和内容的优惠券

用jquery或javascript打印带有图像和内容的优惠券,javascript,jquery,css,image,Javascript,Jquery,Css,Image,在我的jsp中,我有一个打印按钮,在这个按钮上我想显示js中已有的数据 jQuery("#printCoupon").click(function() { PrintDiv(); }); function PrintDiv() { var divToPrint = couponCode; var popupWin = window.open('', '_blank', 'width=600,height=800');

在我的jsp中,我有一个打印按钮,在这个按钮上我想显示js中已有的数据

  jQuery("#printCoupon").click(function() {
        PrintDiv();
    });

    function PrintDiv() {    

        var divToPrint = couponCode;
        var popupWin = window.open('', '_blank', 'width=600,height=800');

        var htmlCode='<table frame="box" style="border-style: dashed;" ><div align="left" class="printDiv" style="vertical-align:middle;height: 6px;width: 9px;max-width:350px;margin:10% auto 0;" ><tr><td>';
        popupWin.document.write('<html><body onload="window.print()"><div style="text-align:center;">Coupon Details</div>'+htmlCode+'' +buisnessName+''+dealTitle+'<br/>'+dealDesc+'<br/>'+dealendDate+'<br/>'+ couponCode + '</div></table></html>');
        popupWin.document.close();
        popupWin.window.close();
             }
但它根本不起作用,我还尝试在单独的文件中编写css 但是css并不适用于此,因为它正在打开新窗口

这是JSFIDLE

http://jsfiddle.net/pw111ktm/

请帮助。

您能为您的用户创建一个JSFIDLE吗requirement@ManikantaReddy请查看JSFIDLE链接,尝试在您的css@ManikantaReddy我应该在哪里添加它?从外部提供css在这里不起作用。
http://jsfiddle.net/pw111ktm/