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="javas cript">
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><t d>';
for(var i=0;i<t.length; i++)
{
imageWidths[i] = Math.round(imag eSize * (Math.round(t[i])/100));
imageName[i] = "imageResul t" + i;
labelName[i] = "spanPercentage " + i;
str = str + '<table cellspacing=2 cellpadding=0 border=0 height=4>';
str = str + '<tr><td bgcolor=' + color[i] + '><img name=' +
imageName[i] + ' id=' + imageName[i] + 'src="images/pixel.gif" width=1
height=1 border=0></td><td><span id=' + labelName[i] + '>' +
Math.round(t[i]) + '%</span></td></tr>';
str = str + '</table>';
}
str = str + "</td></tr></table>";
document.getEle mentById('divTe xt').innerHTML = str;
for(var x = 0; x< imageWidths.len gth; x++)
{
var name = "imageResul t" + x;
var image = document.getEle mentById(imageN ame[x]);
setTimeout("Wai t()", 10);
if(image != null)
{
for(var i = 0; i <= imageWidths[x]; i++)
{
string = "IncreaseSize(" +i+", '"+imageName[x]+"', '" +
labelName[x]+"', '" + imageSize + "')";
setTimeout(stri ng, 40 * i);
}
}
}
}
function Wait()
{
//Wait for a second
}
function IncreaseSize(Si ze, ImageName, LabelName, ImageSize)
{
var image = document.getEle mentById(ImageN ame);
var label = document.getEle mentById(LabelN ame);
if(image != null)
{
image.width = Size;
image.height = 1;
label.innerHTML = Math.round((Siz e/ImageSize) * 100) + "%";
}
}
</script>
<span style="cursor: pointer; text-decoration: underline"
onclick="BuildR esults()">
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.