PDA

View Full Version : Auto load links


BlusionFusion
08-03-2005, 07:45 AM
I have a list of about 150 links(which can change daily), I need a way to make them automaticly load one by one every 20 seconds or so in a frame on my site. I asked a couple people that I know and they said it could probably be done in javascript but they didn't know how to do it. Does anyone know how to do this?

Kor
08-03-2005, 08:56 AM
something like this?:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script type="text/javascript">
var delay = 20000;//in milliseconds
var links=[]
links[0] =['google','http://www.google.com'];
links[1] =['yahoo','http://www.yahoo.com'];
links[2] =['altavista','http://www.altavista.com'];
var i=0;
function linkdel(){
var root=document.getElementById('mydiv');
var oA = document.createElement('a');
oA.setAttribute('href',links[i][1]);
oA.appendChild(document.createTextNode(links[i][0]));
var oBr = document.createElement('br');
root.appendChild(oA);
root.appendChild(oBr);
i++;
var check =(i==links.length)?clearTimeout(check):setTimeout('linkdel()',delay);
}
onload=linkdel;
</script>

</head>
<body>
<div id="mydiv"></div>
</body>
</html>

BlusionFusion
08-03-2005, 10:53 PM
When I said load, I mean I need the link needs to be opened in a frame.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>Links</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK REL=stylesheet HREF="hl.css" TYPE="text/css">
</head>

<frameset cols="25%,75%">
<frame src="lists.html" name="list">
<frame src="side.html" name="side">
</frameset>
<noframes><body>
</body></noframes>
</html>

I need to have the links open up in the "side" frame.

Kor
08-04-2005, 09:06 AM
put the code in that frame

BlusionFusion
08-04-2005, 06:30 PM
put the code in that frame
I tried that code, it just makes the links appear. I need something that will open the links in the other frame. Again, when I say open and load I mean like when you click on a link.

BlusionFusion
08-09-2005, 06:16 AM
*bump*

glenngv
08-09-2005, 07:14 AM
Put this at the head of the frameset page.
<script type="text/javascript">
var delay = 20000;//in milliseconds
var links=['http://www.google.com',
'http://www.yahoo.com',
'http://www.altavista.com' //no comma at the last link
];
function autoOpen(idx){
if (idx<links.length){
var w = window.open(links[i], "side");
w.focus();
setTimeout(function(){ autoOpen(++idx) }, delay);
}
}
window.onload=function(){ autoOpen(0); };
</script>

But why are you loading the pages automatically?
The user may be annoyed by this.