Javascript, works good in IE but in Firefox Mozilla it gives problems

S

shafiqrao

Hello everyone,

I have a script that runs in IE great, but in firefox it has problems.
I understand that there are some objects that are accessed differently
in IE and Mozilla. Can anybody let me know what I need to change in the
file to make a copy that would run fine on Firefox?

Here is the link to the file:
http://people.emich.edu/srehman2/study/polls.html click on the 'Build
Bars' link displayed at the top-right corner. I am copying the source
code here also,

=========================================================
<script language="javascript">
function BuildResults()
{
var str;
var imageWidths = new Array();
var imageName = new Array();
var labelName = new Array();
var imageSize = 140;
var BarImage = "images/poll_yellow.gif";
var t = new Array();
var color = new Array();
t[0] = 60;
t[1] = 30;
t[2] = 50;
t[3] = 112;

color[0] = 'red';
color[1] = 'blue';
color[2] = 'silver';
color[3] = 'green';

str = str + '<table cellspacing=2 cellpadding=0 border=0><tr><td>';
for(var i=0;i<t.length;i++)
{
imageWidths = Math.round(imageSize * (Math.round(t)/100));
imageName = "imageResult" + i;
labelName = "spanPercentage" + i;
str = str + '<table cellspacing=2 cellpadding=0 border=0 height=4>';
str = str + '<tr><td bgcolor=' + color + '><img name=' +
imageName + ' id=' + imageName + 'src="images/pixel.gif" width=1
height=1 border=0></td><td><span id=' + labelName + '>' +
Math.round(t) + '%</span></td></tr>';
str = str + '</table>';

}
str = str + "</td></tr></table>";
document.getElementById('divText').innerHTML = str;


for(var x = 0; x< imageWidths.length; x++)
{
var name = "imageResult" + x;
var image = document.getElementById(imageName[x]);

setTimeout("Wait()", 10);
if(image != null)
{
for(var i = 0; i <= imageWidths[x]; i++)
{
string = "IncreaseSize("+i+", '"+imageName[x]+"', '" +
labelName[x]+"', '" + imageSize + "')";
setTimeout(string, 40 * i);
}
}
}
}
function Wait()
{
//Wait for a second
}

function IncreaseSize(Size, ImageName, LabelName, ImageSize)
{
var image = document.getElementById(ImageName);
var label = document.getElementById(LabelName);

if(image != null)
{
image.width = Size;
image.height = 1;
label.innerHTML = Math.round((Size/ImageSize) * 100) + "%";
}
}
</script>


<span style="cursor: pointer; text-decoration: underline"
onclick="BuildResults()">
Build bars
</span>

<span name="divText" id="divText"></span>
=========================================================

It displays bars in IE but in firefox it do not display anything.

Thanks in advance.

-Shafiq.
 
E

electrician

IE 5+ is what 95 per cent of paying cutomers use. Who cares what
FireFox, Netscape or Opera does. Go for the winner!
 
E

Erwin Moller

IE 5+ is what 95 per cent of paying cutomers use. Who cares what
FireFox, Netscape or Opera does. Go for the winner!

Here is the newsgroup troll again: electrician.

If memory serves me well you were the one giving very bad code with hundreds
of validationerror for that embedded video script, right?

I am still waiting for you to respond to that, 'electrician'.

And because I am today in a very trollable mood, I might also add:
"IE5/6 are both broken, don't code for them, don't use them!"

Maybe you better stick with pulling electrical wires, you are probably good
at that, and let the the programmers give advise about programming, ok?

Why-oh-why do I take that bait? :p

Regards,
Erwin Moller
 
S

shafiqrao

electrician,

I am going for the winner, FireFox is gaining market share IE is losing
it. More and more serious companies have firefox as their standard web
browser. Even some SIG conferences have FireFox as official browser and
they recommend it.

this was about its winning, it is more efficient and secure than IE, It
provides more features to users than IE. Altough opera is even more
efficient than FireFox

that was about its functionality, Now try to open
http://internetexplorer.com they even do not have their matching name
website ... lol

there is more, but google is there for your answers ... I have spent
enough time.
 
R

Randy Webb

Erwin Moller said the following on 4/4/2006 7:27 AM:
Here is the newsgroup troll again: electrician.

If memory serves me well you were the one giving very bad code with hundreds
of validationerror for that embedded video script, right?

I am still waiting for you to respond to that, 'electrician'.

And because I am today in a very trollable mood, I might also add:
"IE5/6 are both broken, don't code for them, don't use them!"

Maybe you better stick with pulling electrical wires, you are probably good
at that, and let the the programmers give advise about programming, ok?

If he pulls wires like he programs, I wouldn't even want him pulling
wires :)
Why-oh-why do I take that bait? :p

Because it's so much fun f**king with a moron :)
 
T

The Magpie

IE 5+ is what 95 per cent of paying cutomers use. Who cares what
FireFox, Netscape or Opera does. Go for the winner!
Except that IE customers *don't* pay - it comes with Windoze (and
Microsoft pays, as fines to the EU. Again).

Also, according to MarketShare who do a wonderful thing called actually
*counting* who uses what, IE accounts for only 84% of browser use and is
dropping like a stone!

Of course, there are other people who count usage, such as Janco
Associates (IE, 82%) or Best Practice.com (IE 79%), but the general
figure is pretty well agreed at around the 80% to 85% mark.

Trolls like yourself do nothing but highlight the dramatically falling
market share of Microsoft's frankly dreadful browser. So keep it up!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,807
Latest member
ryef

Latest Threads

Top