gpt4 book ai didi

javascript - 如何设置打印内容的高度?

转载 作者:行者123 更新时间:2023-11-28 00:49:59 33 4
gpt4 key购买 nike

我有:

function printContent2(div_id)
{
var content = document.getElementById(div_id);
var map_src = window.open("", "PRINT MAP", "width=800,height=600,top=0,left=0,toolbar=no,scrollbars=no,status=no,resizable=no");
map_src.document.write('<html><head>');
map_src.document.write('<link rel="stylesheet" href="/leaflet-0.5.1/0.7.3/leaflet.css"/>');
map_src.document.write('</head><body>');
map_src.document.write(content.innerHTML);
map_src.document.write('</body></html>');
map_src.document.close();
map_src.focus();
map_src.print();
}
.mapstyle {
height: 100%;
height: -webkit-calc(100% - 69px);
height: -moz-calc(100% - 69px);
height: calc(100% - 74px);
margin-left: 420px;
}
div id="map" class="mapstyle"

及之后

printContent2('map');

显示在完整列表中。

我需要设置高度 = 400px。

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

最佳答案

你可以使用这样的东西:

   map_src.document.write("<html><head><style> #"+div_id+"{height:400px !important;font-size:12px;}</style>")

关于javascript - 如何设置打印内容的高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26905062/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com