Click to See Complete Forum and Search --> : Javascript and blank page


SteveinAussie
May 2nd, 2003, 09:15 PM
Hello All,

I am a webmaster of a free article website and i want to add a javascript that allows users to click the new link of the day. But i dont want them to leave the page all i want is for that link to load a new page. I have included th script:

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="JavaScript">
//******************************************************
// * Script from http://ldpoint.com
// * Phone and internet services, tools*
// * You can use this code if you leave this message*
// ******************************************************
function GetTodaysURL()
{
var locationlist = new URLList
(
"http://javascript.internet.com/index.html", // Monday
"http://www.javascript.com", // Tuesday
"http://javascripts.com", //Wednesday
"http://javaboutique.internet.com", //Thursday
"http://www.theguestbook.com", //Friday
"http://www.thecounter.com", //Saturday
"http://wdvl.internet.com" // Sunday
);

now = new Date();
num = now.getDay();
if (num == 0) num = 7;

location.href = locationlist.list[num-1];
}

function URLList ()
{
var argv = URLList.arguments;
var argc = argv.length;
this.list = new Object();
for (var i = 0; i < argc; i++)
this.list[i] = argv[i];
this.count = argc;
return this;
}
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000">
Example of the code, choosing <a href="javascript:GetTodaysURL()"> the page of
that day</a>. Tomorrow here will be shown another page.
<p><center>
</center>
<p>&nbsp;
</body>
</html>

########
Can someone show me how to change this script so that a new page will load if a visitors clicks on one of the daily links?

Any help would be appreciated.

anupam kant
May 3rd, 2003, 12:09 AM
simply instead of
location.href = locationlist.list[num-1];
use
window.open(locationlist.list[num-1]);

other parameters can also be specified for the new window's attributes like height and width.

hope this helps...

N00b@work
May 4th, 2003, 03:36 PM
use window.open();

you can even store a "pointer" to it in a varible.


newWin=window.open("some.html");

SteveinAussie
May 5th, 2003, 02:00 AM
Thanks for the help.

I have it working now................:D