如何在弹出窗口中更改文本大小 [英] How to change the text size in pop-up window

查看:116
本文介绍了如何在弹出窗口中更改文本大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题: - 我有一个父窗口中的内容,它非常显示我想要打印页面的一部分,因此我打开了一个弹出窗口,该字体应该是22px

 函数CallPrint(strid)
{
var prtContent = document.getElementById(strid);
var WinPrint = window.open('','','letf = 0,top = 0,width = 1,height = 1,toolbar = 0,scrollbars = 0,status = 0);
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
}

< div id =content>
< strong style =font-size:9px>这是我要打印的内容,
,但这里是非常小的字体。在这个页面中,我有很多信息
,所以我想打印页面的一部分。这是显示在这个div。 < /强>
< / div>
< input type =buttonvalue =printonclick =CallPrint(strid)>

我得到了一个答案,但那不起作用

  WinPrint .document.write('< span style =font-size:22px>'+ prtContent.innerHTML +'< span>'); 

使用有效的html和特定的css进行打印会更好。


My Question:- I have a content in parent window it's very and i displayed corner of a page i want print that part of a page, so i opened a popup window in that font should be 22px

function CallPrint(strid)
{
 var prtContent = document.getElementById(strid);
 var WinPrint =    window.open('','','letf=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0');
 WinPrint.document.write(prtContent.innerHTML);
 WinPrint.document.close();
 WinPrint.focus();
 WinPrint.print();
 WinPrint.close();
}

<div id="content">
 <strong style="font-size:9px">This is the content i am going to print, 
but here it is very small font. In this page i have lot of information 
so i want to print a part of page. Which is displayed in this div. </strong>
</div>
<input type="button" value="print" onclick="CallPrint(strid)">

I got a answer but that is not working

解决方案

There are several ways to achieve that but there is one :

WinPrint.document.write('<span style="font-size:22px">' + prtContent.innerHTML + '<span>');

It would be better to use valid html and a specific css for printing.

这篇关于如何在弹出窗口中更改文本大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆