473,399 Members | 3,401 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,399 software developers and data experts.

IE, Opera, Netscape, & Mozilla

This code needs to be changed so that it is compatible with other
browsers like Opera, Netscape, and Mozilla.

{
s=a[i].currentStyle.fontSize+'';
s=Right(s,2);
a[i].style.fontSize = parseInt(a[i].currentStyle.fontSize)+factor+s;
}
In particular, the "currentStyle" and "style" i would imagine needs to
be changed to something and i'm not sure how to go about doing that.

Any Suggestions...?

Jul 23 '05 #1
1 1125
jfancy-Transport Canada wrote:
This code needs to be changed so that it is compatible with other
browsers like Opera, Netscape, and Mozilla.

{
s=a[i].currentStyle.fontSize+'';
s=Right(s,2);
a[i].style.fontSize = parseInt(a[i].currentStyle.fontSize)+factor+s;
}
In particular, the "currentStyle" and "style" i would imagine needs to
be changed to something and i'm not sure how to go about doing that.

Any Suggestions...?


I use a function to get a defined style of an element:

function getStyle(aElm, aStyle) {
var lStyle;
try {
if (aElm && typeof aElm.style != "undefined")
lStyle = aElm.style[aStyle];
}
catch(e) {}

var retVal;

if (lStyle)
retVal = lStyle;
else {
// Mozilla
if (document.defaultView) {
aStyle = aStyle.replace(/([A-Z])/g, "-$1").toLowerCase();
retVal =
aElm.ownerDocument.defaultView.getComputedStyle(aE lm,"").getPropertyValue(aStyle);

// some elements might not have a defined value (eg. images)
if (retVal == "auto") {
if (aStyle == "width")
retVal = aElm.offsetWidth;
else if (aStyle == "height")
retVal = aElm.offsetHeight;
}
}
// IE
else if (aElm.currentStyle) {
retVal = aElm.currentStyle[aStyle];
}
else
return null;
}
return retVal;
}

Your script block might then look like this (note, I don't know what
"Right" does and "factor" is so if you don't get it working, you might
show us some more code):

s = getStyle(a[i],"fontSize");
var s_new=Right(s,2);
a[i].style.fontSize = parseInt(s)+factor+s_new;

Daniel
Jul 23 '05 #2

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

Similar topics

4
by: Spijon | last post by:
Seems opera can not work normally with javascript, does anyone knows how to fix it? Thanks in advance.
10
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script...
2
by: MV | last post by:
Hi, I want to try and get a lottery type script to run in these two browsers before i put it on my site. It runs OK in I.E.6 and my friend says it works in netscape 7 so i can't see the problem...
4
by: Table Testing | last post by:
Hi, I've been messing around with tables and found that I can get my desired result in IE no problem but Netscape / Opera and Mozilla all throw a wobbly. I can't for the life of me figure out...
3
by: Howard Martin | last post by:
I have a page at www.caymanquays.com.au/index.html where the navigation at the top works fine in MSIEv6 and Opera v7.5 but appears dead in Mozilla v1.5 and Firefox v1.0. The external sylesheet...
8
by: Bob Richardson | last post by:
After making corrections, and passing the WC3 validation checks for the web page and the CSS, I'm still having problems ... only with Opera (7.54 and 8.0) at: ...
5
by: Asterbing | last post by:
Hello, Here is a page which contains an "evoluated" (to distinguish-it from the simple one) way to hear sound on a html page event. From my memory, it worked under all major browsers, but didn't...
4
by: drclue | last post by:
I've this SVG speaker selection tool I've been working on and it validates with the w3.org. I'd like to see what it does for a few real users here. ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...
0
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...
0
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...

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.