473,545 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Resize text onLoad

Hi,
I am configurating this guestbook that shows text way too big. I have tried
with style sheets and font tags, but they are ignored (not the font, but the
size). I figure a javascript could do it, but I haven't found an applicable
script anywhere. I do think it would be rather straightforward though. I
want the text to be set to x-small (or a relative zoom level) immediately on
load. Anyone that has a script ready?

Regards,

--
Lars Forslin

http://www.connect.to/forslin

"Doing time on Earth"

*************** ***********
Jul 20 '05 #1
3 5594
"Lars Forslin" <la************ ***********@hom e.se> writes:
I am configurating this guestbook that shows text way too big. I have tried
with style sheets and font tags, but they are ignored (not the font, but the
size).
Probably because the code contains something like <font size="+7">.
If that is the case, drop the crap. It's either ancient or written
by somebody not familiar with modern web design.

Alternatively, it might contain elements with an attribute
style="font-size:huge"
or something.
I figure a javascript could do it, but I haven't found an applicable
script anywhere. I do think it would be rather straightforward though. I
want the text to be set to x-small (or a relative zoom level) immediately on
load. Anyone that has a script ready?


Guesses, if it is font tags::

1) find font tags. Remvove the size attribute:
<script type="text/javascript">
function removeFont(){
var fonts = document.getEle mentsByTagName( "font");
for (var i=0;i<fonts.len gth;i++) {
var font = fonts[i];
font.size = "";
font.setAttribu te("size","");
}
}
</script>

2) find and remove font tags using DOM:
<script type="text/javascript">
function removeFont(){
var fonts = document.getEle mentsByTagName( "font");
for (var i=0;i<fonts.len gth;i++) {
var font = fonts[i];
var next = font.nextSiblin g;
var parent = font.parentNode ;
while(font.hasC hildNodes) {
var last = font.lastChild;
parent.insertBe fore(last,next) ;
next = last;
}
}
}
</script>

Code not tested (no pages with <font> available).

Run it from the onload handler.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
Thanks a lot for the suggestions and swift answers. After I wrote I found
this script which I implemented so it looks like this:

<body style="backgrou nd-color:transpare nt" class="brodtext ">
<INPUT ID="zoomfactor " TYPE="text" VALUE="50" SIZE="3" MAXLENGTH="4"
onkeyup="update Zoom()">%

<DIV ID="container" >

<!--- Don't modify the cgi tag --->
<cgi>
<!--- Don't modify the cgi tag --->
</DIV>
<SCRIPT LANGUAGE="JavaS cript">
<!--
function updateZoom() {
container.style .zoom = zoomfactor.valu e + "%";
}
// -->
</SCRIPT>

<P align="center"> <a href="javascrip t:history.back( 1)" class="adress"> Back
to guestbook form</a>
</p>

</body>
It does what it should, it works, but I don't want the user to have to write
in a value. I want this to happen onload automatically with a standard value
of 70%. Can you rewrite this for me?
Many thanks
Lars
"Lasse Reichstein Nielsen" <lr*@hotpop.com > skrev i meddelandet
news:k7******** **@hotpop.com.. .
"Lars Forslin" <la************ ***********@hom e.se> writes:
I am configurating this guestbook that shows text way too big. I have tried with style sheets and font tags, but they are ignored (not the font, but the size).
Probably because the code contains something like <font size="+7">.
If that is the case, drop the crap. It's either ancient or written
by somebody not familiar with modern web design.

Alternatively, it might contain elements with an attribute
style="font-size:huge"
or something.
I figure a javascript could do it, but I haven't found an applicable
script anywhere. I do think it would be rather straightforward though. I
want the text to be set to x-small (or a relative zoom level) immediately on load. Anyone that has a script ready?


Guesses, if it is font tags::

1) find font tags. Remvove the size attribute:
<script type="text/javascript">
function removeFont(){
var fonts = document.getEle mentsByTagName( "font");
for (var i=0;i<fonts.len gth;i++) {
var font = fonts[i];
font.size = "";
font.setAttribu te("size","");
}
}
</script>

2) find and remove font tags using DOM:
<script type="text/javascript">
function removeFont(){
var fonts = document.getEle mentsByTagName( "font");
for (var i=0;i<fonts.len gth;i++) {
var font = fonts[i];
var next = font.nextSiblin g;
var parent = font.parentNode ;
while(font.hasC hildNodes) {
var last = font.lastChild;
parent.insertBe fore(last,next) ;
next = last;
}
}
}
</script>

Code not tested (no pages with <font> available).

Run it from the onload handler.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors:

<URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html> 'Faith without judgement merely degrades the spirit divine.'

Jul 20 '05 #3
As you might suspect I am a novice in this field. I took a look at the
scripts you provided and I have a few questions concerning the first script:
1) Where do I place it? In <head> or <body>?
2) Am I supposed to write the desired font size in: font.size = "";?
3) What about: font.setAttribu te("size",""); - should I enter something
here?
Regards,
Lars

"Lars Forslin" <la************ ***********@hom e.se> skrev i meddelandet
news:0u******** ************@ne wsc.telia.net.. .
Thanks a lot for the suggestions and swift answers. After I wrote I found
this script which I implemented so it looks like this:

<body style="backgrou nd-color:transpare nt" class="brodtext ">
<INPUT ID="zoomfactor " TYPE="text" VALUE="50" SIZE="3" MAXLENGTH="4"
onkeyup="update Zoom()">%

<DIV ID="container" >

<!--- Don't modify the cgi tag --->
<cgi>
<!--- Don't modify the cgi tag --->
</DIV>
<SCRIPT LANGUAGE="JavaS cript">
<!--
function updateZoom() {
container.style .zoom = zoomfactor.valu e + "%";
}
// -->
</SCRIPT>

<P align="center"> <a href="javascrip t:history.back( 1)" class="adress"> Back
to guestbook form</a>
</p>

</body>
It does what it should, it works, but I don't want the user to have to write in a value. I want this to happen onload automatically with a standard value of 70%. Can you rewrite this for me?
Many thanks
Lars
"Lasse Reichstein Nielsen" <lr*@hotpop.com > skrev i meddelandet
news:k7******** **@hotpop.com.. .
"Lars Forslin" <la************ ***********@hom e.se> writes:
I am configurating this guestbook that shows text way too big. I have tried with style sheets and font tags, but they are ignored (not the font, but
the
size).


Probably because the code contains something like <font size="+7">.
If that is the case, drop the crap. It's either ancient or written
by somebody not familiar with modern web design.

Alternatively, it might contain elements with an attribute
style="font-size:huge"
or something.
I figure a javascript could do it, but I haven't found an applicable
script anywhere. I do think it would be rather straightforward though.
I want the text to be set to x-small (or a relative zoom level)

immediately on load. Anyone that has a script ready?


Guesses, if it is font tags::

1) find font tags. Remvove the size attribute:
<script type="text/javascript">
function removeFont(){
var fonts = document.getEle mentsByTagName( "font");
for (var i=0;i<fonts.len gth;i++) {
var font = fonts[i];
font.size = "";
font.setAttribu te("size","");
}
}
</script>

2) find and remove font tags using DOM:
<script type="text/javascript">
function removeFont(){
var fonts = document.getEle mentsByTagName( "font");
for (var i=0;i<fonts.len gth;i++) {
var font = fonts[i];
var next = font.nextSiblin g;
var parent = font.parentNode ;
while(font.hasC hildNodes) {
var last = font.lastChild;
parent.insertBe fore(last,next) ;
next = last;
}
}
}
</script>

Code not tested (no pages with <font> available).

Run it from the onload handler.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors:

<URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'


Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
2098
by: Rob | last post by:
Hi, I have some problems resizing a html page when it is loaded. I want the page to resize to the screensize. The following snipped of code (see below) works perfect on my Windows NT. but not on my Windows 98. Windows 98 with Ms Explorer 6.0.2800.1106IS Update versions:; SP1; q313829; Q328970; Q330994; Q813389l Q818529; Q824145;
9
9801
by: Don | last post by:
Does anyone know where I can find a client-side function I can reference from within an HTML/JavaScript web page? I'm currently using a core PHP function to do this, but I'd rather do it on the client-side and not have to upload the large raw image to the server. Thanks in advance for your help. Don ----== Posted via Newsfeeds.Com -...
8
2395
by: Michael Satterwhite | last post by:
I'm opening a page that has a single image on it. I'd like to resize the window containing the image to the size of the image (slightly larger OK, not smaller). The width isn't a problem, but the height is. The window, of course has things like menu bars, toolbar, navigation, etc. I need to account for these when I resize the image, but I'm...
3
3261
by: John | last post by:
Hi, This is my first experiment with C#, I'm trying to handle the resize event. According to the documentation I should handle the Layout event for this. My question is: how do I register this event? The following code does not work because I never recieve the OnLoad event. What am I doing wrong? public class frmMain :...
15
5311
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the path of the uploaded image, and resize it with the provided dimensions. My function is below. The current function is returning an error when run...
2
9977
by: wolfing1 | last post by:
Maybe this doesn't make any sense, but is it possible to dynamically resize an iframe to the height of its contained page? Something that works in Opera/Firefox/IE. I can resize it with a document.getElementById("frameItems").style.height = "200px" for example, but was wondering if I could access somehow the full size its inner page would...
4
5644
by: DeanJo | last post by:
I am trying to develop a resize module i can include on my pages that calculates the size of input fields based on the screen resolution... I can already detect the screen resolution, and i have the width / height multiplier for every resolution i need to support... my problem is this... I want the include file to be totally universal so...
5
2734
by: Doug Gunnoe | last post by:
I'm considering resizing a div onload to better match the screen width of the user. Easy enough, however it seems that I have read in this group that there are potential problems with this, differences amongst the browsers, inconsistence in determining screen size, and debate about which property to use - and by this I believe there is...
3
2072
by: Jills | last post by:
Hi All, Does anyone have any idea about how can we resize an IFRAME dynamically according to its content from another domain? I want to increase the height according to the page that is displayed on it. Regards, Jills
0
7467
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7401
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7656
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7807
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7756
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5326
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4944
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3450
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
703
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.