473,412 Members | 2,092 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,412 software developers and data experts.

What are the Netscape-Mozilla equivalents?

Hi,

I've written some javascript routines for Internet Explorer and Opera.
Could you tell me the Netscape and Mozilla equivalents?

Thanks

-------------------------

//this works with Opera, not with Netscape and Mozilla:

var menuOpened = false;
var whatMenu = new Object();

function showMenu(menu){ //menu is the id of a DIV element

if ( menu == null ) return;

if (!menuOpened){
menu.style.visibility='visible';
menuOpened = true;
whatMenu = menu;
}
else{
menu.style.visibility='hidden';
menuOpened = false;
whatMenu = null;
}
}

-----------------

//this works only with Internet Explorer and Opera

var clicksBold = 0;

function toggleBold(){

clicksBold++;

SPANs = document.all.tags("SPAN");

for (var h = 0; h < SPANs.length; h++){
x = SPANs[h];
if (x.className == "aClassName"){
if ((clicksBold % 2) == 1) x.style.fontWeight = "bold";
else x.style.fontWeight = "normal";
}
}
}
-----------------

colors = new Array("blue","cyan","lightgreen","green","red","or ange","yellow","pink","violet","black","gray","whi te");
for (var j = 0; j < colors.length; j++){
document.write("<span style='background-color:" + colors[j] + ";
height:25; width:25; border-style:solid; border-width:1pt'></span>*");
}

//the output is a series of sqares in Internet Explorer and Opera,
some black lines in Netscape

--------------------------
//anID is the ID of a SPAN element

<select name="leftMargin"
onchange="anID.style.marginLeft=this.value;">
....
</select>
Jul 20 '05 #1
3 2032
ca********************@yahoo.it (Simba) writes:
//this works only with Internet Explorer and Opera var clicksBold = 0; .... clicksBold++; I would use
var clicksBold = false;
...
clicksBold = ! clicksBold;
It better models what you want: toggling between on and off.
SPANs = document.all.tags("SPAN");

Use:
var SPANs = document.getElementsByTagName("SPAN");

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
DU
Simba wrote:
Hi,

I've written some javascript routines for Internet Explorer and Opera.
Could you tell me the Netscape and Mozilla equivalents?

Thanks

-------------------------

//this works with Opera, not with Netscape and Mozilla:

var menuOpened = false;
var whatMenu = new Object();

function showMenu(menu){ //menu is the id of a DIV element

if ( menu == null ) return;

if (!menuOpened){
menu.style.visibility='visible';
All 3 browsers and many other W3C DOM 1 compliant browsers (Safari 1.0,
Konqueror 3.1.x, MSIE 5.x for Mac, MSIE 5+, etc.) all support
document.getElementById("menu").style.visibility = "visible";
So, it is best for many reasons to use this manner of coding.

Using Web standards in your web pages
http://www.mozilla.org/docs/web-deve...upgrade_2.html

Updating DHMTL Web pages
http://devedge.netscape.com/viewsour...tml-web-pages/
menuOpened = true;
whatMenu = menu;
}
else{
menu.style.visibility='hidden';
menuOpened = false;
whatMenu = null;
}
}

-----------------

//this works only with Internet Explorer and Opera

var clicksBold = 0;

function toggleBold(){

clicksBold++;

SPANs = document.all.tags("SPAN");
Again, like Lasse said, best is to use

spanCollection = document.getElementsByTagName("SPAN");
which is widely and well supported by W3C DOM 1 compliant browsers.

for (var h = 0; h < SPANs.length; h++){
x = SPANs[h];
if (x.className == "aClassName"){
if ((clicksBold % 2) == 1) x.style.fontWeight = "bold";
else x.style.fontWeight = "normal";
}
}
}
-----------------

colors = new Array("blue","cyan","lightgreen","green","red","or ange","yellow","pink","violet","black","gray","whi te");
for (var j = 0; j < colors.length; j++){
document.write("<span style='background-color:" + colors[j] + ";
height:25; width:25; border-style:solid; border-width:1pt'></span> ");


There is a better alternative here to document.write.
DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunc...e7Section.html

Jul 20 '05 #3
"Simba" <ca********************@yahoo.it> wrote in message
news:4e**************************@posting.google.c om...
<snip>
for (var j = 0; j < colors.length; j++){
document.write("<span style='background-color:" + colors[j] + ";
height:25; width:25; border-style:solid;border-width:1pt'></span> ");
}

<snip>

In addition to what Lasse and DU said, the CSS standard requires that
length values used with CSS properties should be provided with units
(px, em, ex, pt, pc, etc or percentages) and Mozilla browsers are
inclined to take a rather literal attitude towards the interpretation of
applicable standards. height:25; may be ignored for that reason alone,
however, the SPAN element is inline and non-replaced so CSS width and
height properties do not apply to it anyway.

Richard.
Jul 20 '05 #4

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

Similar topics

9
by: rez | last post by:
I find it rather frustrating that Netscape 4.x is "no longer supported:" http://help.netscape.com/products/client/communicator/reflib.html Same seems true with IE. How am I ever supposed to...
13
by: Gaurav | last post by:
Hello, i have some java script with in html. It runs fine on IE 6.0 but doesnt run on netscape 7.1 Can someone tell me whats the problem ? And how can i solve it. here is the url ...
2
by: Geniium | last post by:
Hello, Im looking to make work my script on both IE and Netscape. It works fine in IE, but netscape cant handle "dynamic" variables. I need some help! Is there a CORRECT way to pass a string...
9
by: Fabian | last post by:
Is there a way to detect which object currently has the focus in javascript? "this" comes close, but isnt implemented in netscape. -- -- Fabian Visit my website often and for long periods!...
5
by: zaw | last post by:
Hi I am working on implementing this script to shopping cart. Basically, it copies fill the shipping address from billing automatically. I believe one or more syntax is not netscape compatible....
9
by: chandramohan.mani | last post by:
Does Event handlers work in netscape. If yes means can anyone please help me. <HTML><SCRIPT LANGUAGE="JScript"> function mouseclick() { alert("I was clicked on " +...
3
by: Jason | last post by:
We have an Extranet with one customer with 20,000 users that has, unfortunately, standardized on Netscape 4.77 for the entire company. We are in the process of rewriting this application from Java...
2
by: Sam Learner | last post by:
Hello, I am writting a utility program to clean diskspace used by Web Browsers, I can clean up Internet Explorer's temp folder. but I also want to clean up Netscape (any version, but Current 7.2...
63
by: Jake Barnes | last post by:
In the course of my research I stumbled upon this article by Alex Russel and Tim Scarfe: http://www.developer-x.com/content/innerhtml/default.html The case is made that innerHTML should never...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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
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...
0
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...

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.