|
Q971 Is there any way to monitor the contents of a frame, and detect when the location has changed?
irt.org | Knowledge Base | JavaScript | Frame | Q971 [ previous next ]
Q971 Is there any way to monitor the contents of a frame, and detect when the location has changed?
If the pages are your pages, i.e. all on the same server, then you
could monitor the other frame using:
In the frameset page:
<html>
<head>
<script language="JavaScript"><!--
var lastUrl = '';
function doSomething() {
// do something
}
function monitor() {
if (lastUrl != window.frame1.location.href) {
lastUrl = window.frame1.location.href);
doSomething();
}
setTimeout('monitor()',1000);
}
function startToMonitor() {
lastUrl = window.frame1.location.href;
}
//--></script>
</head>
<frameset rows="50%,*" onLoad="startToMonitor()">
<frame src="page1.htm" name="frame0">
<frame src="page2.htm" name="frame1">
</frameset>
</html>
|
Feedback on 'Q971 Is there any way to monitor the contents of a frame, and detect when the location has changed?'
|
|
Copyright © 1996-2008 irt.org, All Rights Reserved.