交换字体的大小 [英] swap fonts' size

查看:106
本文介绍了交换字体的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我希望修改给定表格中的字体尺寸(

是,还不在整个页面中);当我按下按钮时,字体的大小

增加1点;另一个按钮减少1点(从

默认大小开始),最后一个按钮将其重置为原始大小。


实际上,无论哪个可能是默认大小(我从三个CSS设置,

相应地交换到屏幕的res),该表中的文本

应仅调整大小从默认大小开始+1或-1的步长。任何

想法?

解决方案

卡特尔写道:

你好,我希望修改给定表格中的字体尺寸(
,但尚未在整个页面中);当我按下按钮时,字体的大小增加1点;另一个按钮减少1点(从
默认大小开始),最后一个按钮将其重置为原始大小。

实际上,无论哪个可能是默认大小(我从三个css设置,相应地交换到屏幕的res),该表中的文本应该仅从默认大小+1或-1点开始调整大小。任何
想法?




是的,我有一两个想法。让用户使用内置机制

调整字体大小。这就是它的用途。


第二个想法:我的屏幕分辨率与任何东西有什么关系?

嗯,除了我的分辨率以外的任何东西。我向你保证600X800在我的19英寸的b $ b上显示器在15英寸

显示器上*不*看起来/执行与600X800相同。当涉及到我的浏览器大小

窗口时,它也不重要。如果我在2560x960双显示器上有一个600x800的浏览器窗口

桌面,那么世界上的什么让你觉得我想在页面上找到一些巨大的怪物字体




用字体停止f **王 - 问题结束。


-

兰迪

comp.lang.javascript常见问题 - http://jibbering.com/faq & ;每周新闻组


" Randy Webb" <您好************ @ aol.com> ha scritto nel messaggio

新闻:Mp ******************** @ comcast.com ...

是的,我有一两个想法。让用户使用内置机制来调整字体大小。多数民众赞成在那里。


我已经提出了想法,还没有提出意见。

第二个想法:我的屏幕分辨率与任何事情有什么关系?好吧,除了我的解决方案之外的其他任何事情。我向你保证,我的19
显示器上的600X800 *在15英寸显示器上看起来不像600X800那样。
在浏览器窗口大小方面也不重要。如果我在2560x960双显示器桌面上有一个600x800的浏览器窗口,那么世界上的什么让你觉得我想要一些巨大的怪物字体在页面上?


UH?抱歉.....你还好吗?

用字体停止f **王 - 问题结束。




感到孤单?或者只是有点哲学?


(重复)


一些严肃的剧本?


"卡特尔" < BM ***** @ hotmail.com>写道:

您好,我希望修改给定表格中的字体尺寸(
是,还没有在整个页面中);当我按下按钮时,字体的大小增加1点;另一个按钮减少1点(从
默认大小开始),最后一个按钮将其重置为原始大小。


如果您不知道原始尺寸,这很难。如果你想按钮

将字体大小增加10%,那么它就容易多了。例如:


----

< script type =" text / javascript">

var size = 0;

var delta = 10;

函数fontSize(n){

if(n == 0){

size = 0;

}否则{

size + = n;

}

文件。 getElementById(" tableId")。s​​tyle.fontSize =

(100 + size * delta)+"%";

}

< / script>


< input type =" button"值= QUOT; A-" onclick =" fontSize(-1);">

< input type =" button"值= QUOT;!A" onclick =" fontSize(0);">

< input type =" button"值= QUOT; A +" onclick =" fontSize(+1);">

< table id =" tableId">

< tr>< td> Test< ; / td>< tr>

< / table>

---

实际上,无论哪个可能是默认大小(我从三个CSS设置,
相应地交换到屏幕的res,


坏主意。屏幕分辨率不会告诉您任何浏览器或屏幕的实际

大小。我有一台笔记本电脑附加额外的CRT

屏幕。较大的CRT屏幕具有较低的分辨率(而且我只能开始猜测你认为屏幕分辨率是多少?
:)。

只需使用用户配置的默认字体大小。

该表中的文本应仅按步骤+1
或-1点来调整大小默认大小。任何想法?




如果步骤必须是1分,那么你必须找到

目前的大小*以分为单位* 。这甚至可能是不可能的,如果你没有将b

表格的任何人提供给你的剧本。在某些浏览器中,您可以找到的是字体大小的计算值,这可能是以像素为单位,并且没有办法从像素到
积分。


/ L

-

Lasse Reichstein Nielsen - lr*@hotpop.com

DHTML死亡颜色:< URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>

'没有判断的信仰只会降低精神神圣。''


Hello, I wish to modify the dimension of the font within a given table (that
is, not yet in the whole page); when I hit a button, the font''s size
increases by 1 point; another button decreases it by 1 point (starting from
the default size), and a last button will reset it to the original size.

Pratically, whichever might be the default size (which I set from three css,
swapped accordingly to the screen''s res), the text inside that table it
should be resized only by step of +1 or -1 point from the default size. Any
ideas?

解决方案

Cartel wrote:

Hello, I wish to modify the dimension of the font within a given table (that
is, not yet in the whole page); when I hit a button, the font''s size
increases by 1 point; another button decreases it by 1 point (starting from
the default size), and a last button will reset it to the original size.

Pratically, whichever might be the default size (which I set from three css,
swapped accordingly to the screen''s res), the text inside that table it
should be resized only by step of +1 or -1 point from the default size. Any
ideas?



Yeah, I have an idea or two. Let the user use the built-in mechanism for
adjusting font sizes. Thats what it is there for.

Second idea: What has my screen resolution got to do with anything?
Well, anything other than my resolution. I promise you that 600X800 on
my 19" monitor does *not* look/perform the same as 600X800 on a 15 inch
monitor. Nor does it matter when it comes to the size of my browser
window. If I have a 600x800 browser window on a 2560x960 dual monitor
desktop, what in the world makes you think I want some huge monster font
on the page?

Stop f**king with the fonts - end of problem.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly


"Randy Webb" <Hi************@aol.com> ha scritto nel messaggio
news:Mp********************@comcast.com...

Yeah, I have an idea or two. Let the user use the built-in mechanism for
adjusting font sizes. Thats what it is there for.
I''ve asked for ideas, not yet for "opinions".
Second idea: What has my screen resolution got to do with anything? Well,
anything other than my resolution. I promise you that 600X800 on my 19"
monitor does *not* look/perform the same as 600X800 on a 15 inch monitor.
Nor does it matter when it comes to the size of my browser window. If I
have a 600x800 browser window on a 2560x960 dual monitor desktop, what in
the world makes you think I want some huge monster font on the page?
UH? Sorry..... Are you ok?
Stop f**king with the fonts - end of problem.



Feeling lonely? Or just kinda philosophical?

(repeat)

Some serious scripts?


"Cartel" <bm*****@hotmail.com> writes:

Hello, I wish to modify the dimension of the font within a given table (that
is, not yet in the whole page); when I hit a button, the font''s size
increases by 1 point; another button decreases it by 1 point (starting from
the default size), and a last button will reset it to the original size.
That''s hard if you don''t know the original size. If you want the button
to increase the font size by 10%, then it''s much easier. E.g.:

----
<script type="text/javascript">
var size = 0;
var delta = 10;
function fontSize(n) {
if (n == 0) {
size = 0;
} else {
size += n;
}
document.getElementById("tableId").style.fontSize =
(100 + size * delta) + "%";
}
</script>

<input type="button" value="A-" onclick="fontSize(-1);">
<input type="button" value="A!" onclick="fontSize(0);">
<input type="button" value="A+" onclick="fontSize(+1);">
<table id="tableId">
<tr><td>Test</td><tr>
</table>
---
Pratically, whichever might be the default size (which I set from three css,
swapped accordingly to the screen''s res),
Bad idea. The screen resolution tells you nothing about the actual
size of either browser or screen. I have a laptop with an extra CRT
screen attached. The larger CRT screen has the lower resolution (and I
can only begin to guess what you would think the screen resolution is
:).

Just go with the user''s configured default font size.
the text inside that table it should be resized only by step of +1
or -1 point from the default size. Any ideas?



If it is imperative that the steps are 1 point, then you have to find
the current size *in points*. That might not even be possible, if you
don''t have it provided to your script by whoever choses the style
sheet. What you can find, in some browsers, is the computed value of
the font size, which is probably in pixels, and there is no way to go
from pixels to points.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
''Faith without judgement merely degrades the spirit divine.''


这篇关于交换字体的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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