473,322 Members | 1,690 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Interesting

I need this code to work for all the IE, Netscape, Opera, and Mozilla
versions. To go about doing this, it is a definite task. I have it
working in IE(all versions) but it will not increment or decrement the
font size in any other browsers. Any suggestions?
<html>
<head>

</head>
<body>
<h1>Hello there</h1>
<h2>Test</h2>
anything.

<input type="submit" onclick="resizeBodyText(2, 'n')" >
<input type="submit" onclick="resizeBodyText(-2, 'n')" >
<button type="submit" onclick= "resizeBodyText(0, 'y')" >
<script type="text/javascript">
//-------------------------------------------------
var current = parseInt(getCookie("fontFactor"))
if (isNaN(current))
current= 0;

resizeBodyText(current, "n")
function resizeBodyText(factor, reset)
{
if (reset=="y")
factor= (current * -1);

window.alert(current + " " + factor)
//------------------------------------------------
if (document.all) {
var a = document.all;
var s = '';
current += factor;
var test = "IE!"
if (current < 0)
current = 0;
else
for (var i = a.length-1; i >0;i--)
{
s=a[i].currentStyle.fontSize+'';
s=Right(s,2);
a[i].style.fontSize = parseInt(a[i].currentStyle.fontSize)+factor+s;
}
setCookie("fontFactor", current)
}
else if (document.getElementsByTagName) {
var a = document.getElementsByTagName("*");
var s = '';
current += factor;
var test = "Netscape 6+!"
if (current < 0)
current = 0;
else
for (var i = a.length-1; i >0;i--)
{
s=a[i].style.fontSize+'';
s=Right(s,2);
a[i].style.fontSize = parseInt(a[i].style.fontSize)+factor+s;
}
setCookie("fontFactor", current)
}
else if (document.layers) {
var a = document.layers("*");
var s = '';
current += factor;
var test = "Netscape OLD 4!";
if (current < 0)
current = 0;
else
for (var i = a.length-1; i >0;i--)
{
s=a[i].style.fontSize+'';
s=Right(s,2);
a[i].style.fontSize = parseInt(a[i].style.fontSize)+factor+s;
}
setCookie("fontFactor", current)
}
window.alert(test)
}
//-----------------------------------------------
function Right(str, n) {
if (n <= 0)
return "";
else if (n > String(str).length)
return str;
else {
var iLen = String(str).length;
return String(str).substring(iLen, iLen - n);
}
}
//-------------------------------------------------
function getCookie(name) {
var dc = document.cookie;
var index = dc.indexOf(name + "=");
if (index == -1) return null;
index = dc.indexOf("=", index) + 1; // first character
var endstr = dc.indexOf(";", index);
if (endstr == -1) endstr = dc.length; // last character
return unescape(dc.substring(index, endstr));
}
function setCookie(name, value)
{
document.cookie= name + "=" + escape(value);
}

</script>

</body>
</html>

Jul 23 '05 #1
6 1143
Lee
jfancy-Transport Canada said:

I need this code to work for all the IE, Netscape, Opera, and Mozilla
versions. To go about doing this, it is a definite task. I have it
working in IE(all versions) but it will not increment or decrement the
font size in any other browsers. Any suggestions?


Most browsers already have a menu option and/or shortcut key to
increment/decrement the font size. Why add another thay may or
may not work?

Jul 23 '05 #2
Don't ask me, ask Transport Canada.

Jul 23 '05 #3
jfancy-Transport Canada wrote:
Don't ask me, ask Transport Canada.


But you are representing them, you are supposedly the competent
authority on the matter, it is *your* duty to explain to Transport
Canada that its a stupid idea.

Please read the group FAQ, thoroughly.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
Jul 23 '05 #4
Believe me, I already have, but I am a student and I don't think I have
that kind of authority right now!

So, any suggestions or ?

Jul 23 '05 #5
JRS: In article <11**********************@o13g2000cwo.googlegroups .com>
, dated Wed, 1 Jun 2005 06:00:02, seen in news:comp.lang.javascript,
jfancy-Transport Canada <ju*********@gmail.com> posted :
Believe me, I already have, but I am a student and I don't think I have
that kind of authority right now!

So, any suggestions or ?


For proper quoting when using Google for News :-
Keith Thompson wrote in comp.lang.c, message ID
<ln************@nuthaus.mib.org> :-
If you want to post a followup via groups.google.com, don't use
the "Reply" link at the bottom of the article. Click on "show
options" at the top of the article, then click on the "Reply" at
the bottom of the article headers.

Since that is what the experts in this newsgroup prefer to read, it will
be to your advantage to comply.

You have already been told to read the FAQ.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #7

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

Similar topics

8
by: Bruno R. Dias | last post by:
Perhaps it would be interesting to program a virtual machine simulating an ancient computer (such as the pdp-7). Then, it would be rather interesting to code for it (porting gcc to it maybe?). I...
12
by: rawrite | last post by:
I am just finishing watching a documentary about Rod Serling. It was cool, but after 20 minutes it got boring and all I wanted to do is subscribe to Net Flix and rent the Twilight Zone episodes....
3
by: Johnny Lee | last post by:
Hi, Look at the follow command in python command line, See what's interesting?:) >>> class A: i = 0 >>> a = A() >>> b = A() >>> a.i = 1 >>> print a.i, b.i
2
by: Dylan Phillips | last post by:
A strang error is occurring when I run the following code: SqlConnection c = new SqlConnection(); c.ConnectionString = "Initial Catalog=Northwind;user id=sa;password=kat1ie;Data Source=server";...
3
by: eBob.com | last post by:
Is there a namespace of interesting and important constants such as maximum length of a filename, maximum length of a path, maximum and minimum values which can be held by a Long (and other data...
8
by: Mythran | last post by:
Here is some code the provides some really interesting results! First, read over the two methods in class 'A' and compare. Just by looking at them, both results appear to return the EXACT same...
28
by: v4vijayakumar | last post by:
#include <string> #include <iostream> using namespace std; int main() { string str; str.resize(5); str = 't';
126
by: jacob navia | last post by:
Buffer overflows are a fact of life, and, more specifically, a fact of C. All is not lost however. In the book "Value Range Analysis of C programs" Axel Simon tries to establish a...
4
by: timer | last post by:
In the years past, there used to very interesting discussions in c.l.c But now, topics are not as interesting anymore. What happened?
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.