[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ProgSoc] javascript refresh without changing viewing position
Hey all,
I'm trying to write a quick and dirty page refresher in Javascript for
my Dad's MSIE 6.0. The effect I'm aiming for is exactly the same as
pressing F5 every few seconds.
The following code does refresh the window, but it places the viewing
window at the top of the reloaded page. F5 will leave you half-way down
the page if that's where you were when you pressed it.
I've tried newWindow.location.reload() but I don't seem to have access
to another window's location element.
This is my first attempt at javascript. Clue anyone?
<SCRIPT LANGUAGE="JavaScript"><!--
refreshInterval = 3; // in seconds
url = 'http://finance.yahoo.com/q?s=^DJI&d=c&k=c3&p=e10,m5,v&t=1d&l=on&z=l&q=c'
newWindow = window.open(url);
newWindow.focus();
refresh();
function waitabit() {
setTimeout('refresh()', refreshInterval * 1000);
}
function refresh() {
newWindow.location.replace(url);
// newWindow.location.reload();
waitabit();
}
//--></SCRIPT>
--
Tom
Opportunities multiply as they are seized
-- Sun Tzu, "The Art of War"
-
You are subscribed to the progsoc mailing list. To unsubscribe, send a
message containing "unsubscribe" to progsoc-request@nospam.progsoc.uts.edu.au.
If you are having trouble, ask owner-progsoc@nospam.progsoc.uts.edu.au for help.