This script works in ie but NOT Firefox. Can someone help me make it work in both.

Script just creates and rotates the url that it uses. :mad:

<html>
<head>
<title>Corvallis Calendar - Home</title>

<SCRIPT LANGUAGE="JavaScript" type="text/javascript" >

<!-- //

var myDate = new Date();
var myMonth = myDate.getMonth();
myMonth = myMonth + 1;
var prefix = 'cal';
var CalURL = prefix + myMonth + '.html';

function rotate() {


window.location.reload(CalURL);

}

//-->

</SCRIPT>
</head>

<body onLoad="javascript:rotate()">

</body>
</html>

Recommended Answers

All 4 Replies

You know that getMonth() returns a number. What do your URL's look like??

I have created calendars for each month and this script is used to grab the current months file so for this month using this var CalURL = prefix + myMonth + '.html', CalURL should be cal3.html. I hope this clears up some confusion.

Taz

See that window.location.reload() is having problem..............

the definition says that........


relaod() --------- this is ok since you r not using this type.
reload(force) -------- but check out this one. force is the boolean handle.

and this is applicable for FireFox and Netscape......

so that is the reason its not working in FireFox......

Alternative:

use

window.location.replace(url)

this method to achieve your requirement.... i think this will meet your purpose.....

But just check out what replace(url) method does.....

The replace() method of the Location object causes the specified URL to be loaded and displayed, but instead of creating a new entry in the hisory array for that URL, it overwrites the URL of the current entry in the array

if this is fine for you u can use this replace() instead..........

Nilesh............

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.