go to URL

I need a few lines of javascript that:
1. goes to a URL
2. waits a couple seconds
3. goes to another URL
omomAsked:
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.

Michel PlungjanIT ExpertCommented:
You need frames (or layers) for that:

<HTML>
<HEAD>
<SCRIPT>
sites = new Array(
'www.site1.com',
'www.site2.com',
'www.site3.com',
'www.site4.com'
);
curSite = 0;
speed = 10000; // 10 secs
function goUrl() {
   top.main.location = sites[curSite];
   if (curSite >= sites.length) curSite = 0;// wrap
   setTimeOut('goUrl()',speed);
}
</SCRIPT>
</HEAD>
<FRAMESET ROWS="100%,*" onLoad="top.goUrl()">
<FRAME NAME="main" SRC="javascript:' '">
<FRAME NAME="dummy" SRC="javascript:' '">
</FRAMESET>
</HTML>

Michel
0

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
omomAuthor Commented:
Modifying it for errors and functionaility, the following is the final product.  Thanks.

<HTML>
<HEAD>
<SCRIPT>
sites = new Array(
  'http://www.dogpile.com',
  'http://www.altavista.com',
  'http://www.lycos.com',
  'http://www.hotbot.com'
);

curSite = 0;
speed = 3000; // 3 secs

function goUrl() {
  top.main.location = sites[curSite];
  curSite++;

  if ((curSite >= 0) && (curSite < sites.length))
    setTimeout('goUrl()',speed);
} // end goURL

</SCRIPT>
</HEAD>
<FRAMESET ROWS="100%,*" onLoad="top.goUrl()">
<FRAME NAME="main" SRC="javascript:' '">
<FRAME NAME="dummy" SRC="javascript:' '">
</FRAMESET>
</HTML>
0
Michel PlungjanIT ExpertCommented:
Ok,

I see you now stop at the last site, but may I inquire, what errors, and why bother with (curSite >= 0) unless you have code somewhere else that makes it negative???

curSite starts out as 0 and is only added to...


Michel
0
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
JavaScript

From novice to tech pro — start learning today.