2011-08-19 77 views
0

这是我得到了 - 这要感谢在计算器搜索选项的功能和地雷打开document.windows,打印和关闭(不关闭)

<script type="text/javascript"> 

    function imprimirElemento(elem) 
    { 
     abrirElemento($(elem).html()); 
    } 

    function abrirElemento(data) 
    { 
     var style = '<style type="text/css">.titulosLightBox {border-bottom: 1px dotted #D1D1D1;color: #333333;font-size: 20px;font-weight: normal;line-height: 18px;margin-bottom: 15px;padding-bottom: 10px;}'+'strong{width:100%;font-weight:bold;}'+'</style>'; 

     var termsAndConditions = window.open('', 'tos', 'height=400,width=600'); 

     termsAndConditions.document.write('<html><head><title>Politica de Privacidad</title>'); 
     termsAndConditions.document.write(style); 
     termsAndConditions.document.write('</head><body >'); 
     termsAndConditions.document.write(data); 
     termsAndConditions.document.write('</body></html>'); 
     termsAndConditions.document.close(); 
     termsAndConditions.print(); 
     termsAndConditions.document.close(); /*This seems not to work*/ 
     return true; 
    } 

</script> 

一些修改它的伟大工程,它打开的窗口;该文件正在打印样式和一切,但窗口其未关闭,

任何想法为什么?

非常感谢

回答

0

最后一行是错误的,因为你已经关闭文档对象。尝试termsAndConditions.close()

+0

我是个骗子-.- – walialu

+0

? @Walilalu当我有同样的想法时,这不是我的错,但我工作中的代理服务器阻止了一个快速的答案。 – reporter

2

尝试

termsAndConditions.close();