Mozilla needs to reload frame for script to work?

Hi there,

I am starting up an IT company thing and well I am designing my site for it. I am a novice at Javascript and have been editing scripts according to how much can I make my computer crash :-)

I have a script which loads a news ticker, and it works fine in IE but for some reason Mozilla Firefox needs to reload the frame (yes its a site with frames) for the ticker to appear. Its almost as if the onload function is being ignored. Can anyone help please? The code is below:


<html>
<head>

<script type="text/javascript" language="JavaScript">

<!--

// news ticker function

var newslist=new Array();
var cnt=0;               // current news item
var curr = "";
var i=-1;               // current letter being typed

newslist[0]=new Array("Check out the share check javascript","poptest.html","250","150","pop","1")
newslist[1]=new Array("Use this javascript to create your own fruit machine","http://www.google.com","350","250","pop","0")
newslist[2]=new Array("Create a To Do list with this script","poptest3.html","250","250","pop","1")
newslist[3]=new Array("Use this script to register users on your site","poptest4.html","650","100","pop","1")
newslist[4]=new Array("This script tells your users the last time they visited your site","poptest5.html","150","150","pop","1")

function newsticker()
{
     // next character of current item
     if (i < newslist[cnt][0].length - 1)
     {
          i++;
          temp1 = newslist[cnt][0];
          temp1 = temp1.split('');
            curr = curr+temp1[i];
          temp2 = newslist[cnt][1];
          temp3 = newslist[cnt][2];
          temp4 = newslist[cnt][3];
          temp5 = newslist[cnt][4];
                if (newslist[cnt][5] >= 1) {
            mtxt.innerHTML = "<small><a href='javascript:popup(temp2, temp5, temp3, temp4)'><font color='#ff0000'>"+curr+"_</small></font></a>";
            }
            else {
            mtxt.innerHTML = "<small><a href="+temp2+" target='_blank'><font color='#ff0000'>"+curr+"_</small></font></a>";
            }
            setTimeout('newsticker()',10)
          return;
     }

     // new item
     i = -1; curr = "";
     if (cnt<newslist.length-1)
          cnt++;
     else
          cnt=0;
     setTimeout('newsticker()',3000)

}

// popup function

function popup(url, name, dimW, dimH){
      dimX = (screen.availWidth - dimW) / 2
      dimY = (screen.availHeight - dimH) / 2
      feats = "width="+dimW+",height="+dimH+",left="+dimX+",top="+dimY+",screenX="+dimX+",screenY="+dimY+",scrollbars=0,resizable=0,location=0,menubar=0,toolbar=0,status=0";
      window.open(url, name, feats)
}

-->

</script>

</head>

<body onLoad = "newsticker()">

<!-- News Ticker -->
          <div align=right><small><b>Magic News Ticker!</b></div></small>
          <small>
          <Span Id="mtxt" style="position:relative;top:1px;padding:5px 5px 5px 5px;font-family:Arial;font-size:10pt;width:100%;overflow:auto;height:50px">
          </Span>
</body>
</html>


Many thanks,

Gabs
gaa00Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gaa00Author Commented:
This page will work fine standalone in Firefox but not as part of a framed site, i.e. the reload needs to be done when accessing the website. (The Magic bit appears but not the ticker)
ZvonkoSystems architectCommented:
Check this version:


function newsticker(){
     // next character of current item
     if (i < newslist[cnt][0].length - 1)
     {
          i++;
          temp1 = newslist[cnt][0];
          temp1 = temp1.split('');
            curr = curr+temp1[i];
          temp2 = newslist[cnt][1];
          temp3 = newslist[cnt][2];
          temp4 = newslist[cnt][3];
          temp5 = newslist[cnt][4];
            var theSpan = document.getElementById("mtxt");
            if (newslist[cnt][5] >= 1) {
              theSpan.innerHTML = "<small><a href='javascript:popup(temp2, temp5, temp3, temp4)'><font color='#ff0000'>"+curr+"_</small></font></a>";
            } else {
              theSpan.innerHTML = "<small><a href="+temp2+" target='_blank'><font color='#ff0000'>"+curr+"_</small></font></a>";
            }
            setTimeout('newsticker()',10)
          return;
     }

     // new item
     i = -1; curr = "";
     if (cnt<newslist.length-1)
          cnt++;
     else
          cnt=0;
     setTimeout('newsticker()',3000)

}


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gaa00Author Commented:
Thank you Zvonko! You are a genius :-) It was really miffing me off.

Thanks for everything
ZvonkoSystems architectCommented:
You are welcome.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.