473,602 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

resizeing text with javascript ???? THANKS

uso
Hi, how can I resize text on my web page. From smaller
fonts to larger. For example, on web page I click several
times on picture or butten or... and my text several times
go larger, when I click on other picture it goes smaller.
I have donn it with picture, but in this version I onley
change the width and heigt parametars. Sorry for bad
English. THANKS

<script language="JavaS cript">
function zoom(i) {
if (i==1)
{
if (document.pictu re1.width<700)
{
document.slika1 .width=document .picture1.width *1.30
document.slika1 .height=documen t.picture1.heig ht*1.30
}
}
else
{
if (document.pictu re1.height>100)
{
document.slika1 .width=document .picture1.width *0.70
document.slika1 .height=documen t.picture1.heig ht*0.70
}
}
if (i==3)
{
document.pictur e1.width=350
document.pictur e1.height=254
}
}
</script>
Jul 23 '05 #1
3 1114
uso wrote:
Hi, how can I resize text on my web page. From smaller
fonts to larger.


Alter the CSS font-size property of the body element (assuming you haven't
done something silly like defining font sizes for other elements in a size
that isn't proportional to the user's preference).

I wouldn't bother though. I'm not aware of any browser which would support
that that doesn't come with its own facility for resizing text. Presenting
users with UIs that duplicate existing functionality but which only work
for your site is generally a bad idea.
--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #2
DU
uso wrote:
Hi, how can I resize text on my web page.
By first choosing relative font-size unit values (like em or %). And
then by letting the user do this himself via his browser interface.
Duplicating the interface of the browser is usually a bad idea.

From smaller fonts to larger. For example, on web page I click several
times on picture or butten or... and my text several times
go larger, when I click on other picture it goes smaller.
I have donn it with picture, but in this version I onley
change the width and heigt parametars. Sorry for bad
English. THANKS

<script language="JavaS cript">
function zoom(i) {
if (i==1)
{
if (document.pictu re1.width<700)
This will only work in MSIE. Give the pictures (the <img> element) an id
attribute value and then access these elements this way

document.getEle mentById(idAttr Value)

Using Web Standards in Your Web Pages
http://www.mozilla.org/docs/web-deve...tml#dom_unsupp

{
document.slika1 .width=document .picture1.width *1.30
document.slika1 .height=documen t.picture1.heig ht*1.30
}
}
else
{
if (document.pictu re1.height>100)
{
document.slika1 .width=document .picture1.width *0.70
document.slika1 .height=documen t.picture1.heig ht*0.70
}
}
if (i==3)
{
document.pictur e1.width=350
document.pictur e1.height=254
}
}
</script>


DU
--
The site said to use Internet Explorer 5 or better... so I switched to
Firefox 1.0.4 :)
Jul 23 '05 #3
DU
DU wrote:
uso wrote:
Hi, how can I resize text on my web page.

By first choosing relative font-size unit values (like em or %).

W3C Quality Assurance tip for webmaster:
Care With Font Size, Recommended Practices: Forget <font>, use CSS
"Do not specify the font-size in pt, or other absolute length units.
They render inconsistently across platforms and can't be resized by the
User Agent (e.g browser).
Use relative length units such as percent or (better) em, (...)"
http://www.w3.org/QA/Tips/font-size#goodpractice

DU
--
The site said to use Internet Explorer 5 or better... so I switched to
Firefox 1.0.4 :)
Jul 23 '05 #4

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

Similar topics

3
6151
by: Randell D. | last post by:
Folks, I'm still learning javascript - I've invested in a couple of books and reading online as much as possible. I'm pretty sure what I am suggesting is possible though I'm trying to weigh up the faults that might go with the suggestion... all opinions welcome. My question: I have a list of links that go to pages that have a similar layout. Could I have a text swap, similar to what I've seen with image swaps (or an image switch)...
6
6073
by: nate | last post by:
Hello, Does anyone know where I can find an ASP server side script written in JavaScript to parse text fields from a form method='POST' using enctype='multipart/form-data'? I'd also like it to parse the filename. <form name='form1' method='POST' enctype='multipart/form-data' action='sub.asp'> <input type='text' name='title1' value='value1'> <input type='file' name='file1'>
4
3403
by: frogman042 | last post by:
My daughter is playing around trying to learn JavaScript and she wrote a small program that prints out a message in increasing and decreasing font size and color changes. She is using document write and it works fine until she puts it into a function and then calls the function from a button with onClick. This also seems to work OK, with the exception that the page is cleared, and the curser changes (and stays) as an hourglass. In...
12
2287
by: Randell D. | last post by:
Folks, I have a form called "ourTestForm". Its a test form - nothing special - it contains five input tags - they are named one, two, three, four and five. The input tags are of type text,text,radio,checkbox and select. When I run the following code, it correctly reports "text" (for input
1
3741
by: IkBenHet | last post by:
Hello, I found this script to create a simple rich text form (http://programmabilities.com/xml/index.php?id=17): <html> <head> <title>Rich Text Editor</title> </head> <body>
3
1968
by: moondaddy | last post by:
I have some text in a page that when a certain even happens, I need to make it glow from black to red (through a spand of 1 second) pause for a few seconds, and then slowly change from red to black over a span of 1 second again. Lastly, this needs to be compatible with NS 4 if possible, or if not possible, then at least so NS4 doesnt crash or get errors. This is to flag a user that something has happened. Thanks.
6
12989
by: Chris Fink | last post by:
Does anyone know it is possible to include a small image(.gif .jpeg) within a <SELECT><option> so that the user would see the option text as well as a little image(icon) in the option? I know this is not an ASP.NET related question, but I know this group is knowledgeable and quick with responses. Thanks
3
971
by: Henrik | last post by:
Hi.. How can i resize an image from a tif-file? And save it to a new file?
4
8659
by: Dabbler | last post by:
Is there a way to mark the text in a TextBox control as selected so when the user types a new value the existing text is replaced? Thanks
0
7993
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8401
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8404
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8054
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6730
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5440
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3900
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3944
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.