Mr Twirly Cane
10-13-2003, 04:02 AM
Hi!
I can muddle through JS but I'm no pro...
Below is frames() a dynamic frameset script for visitors hitting my internal pages out-of-frames. Works just fine but writes the frameset too quick, visitors can't back-out. I simply want to show a message "You are out of frames buddy" and give a polite 2 second pause before writing the frameset.
So I'm calling detect() from the body tag to doc.write a message and pause before calling "frames()". My message is getting onscreen but function frames() won't function! If I delete my document.write message then it all works just fine?!? What on Earth am I doing wrong?
Many thanx in advance...
<script language="JavaScript">
<!--
function detect() {
if (top.frames.length==0) {
document.write('<font size="2" color="crimson" face="verdana,helvetica,sans-serif"><b>out of frames</b></font><br>');
document.write('<font size="1" color="black" face="verdana,helvetica,sans-serif">loading frameset...</font>');
timer=setTimeout('frames()',2000) }
}
function frames() {
framesetpage="awnings-frameset.html";
thispage=window.location.href;
if (thispage.indexOf('://')<0) {thispage="://"+thispage;};
prefix=thispage.substring(0,thispage.lastIndexOf('://'));
suffix=thispage.substring(thispage.lastIndexOf('://')+3,thispage.length);
// alert('the subpage is:['+prefix+']['+suffix+']');
if (parent.location.href==window.location.href) {parent.location.href=framesetpage+"?"+prefix+"&&&"+suffix};
}
// -->
</script>
I can muddle through JS but I'm no pro...
Below is frames() a dynamic frameset script for visitors hitting my internal pages out-of-frames. Works just fine but writes the frameset too quick, visitors can't back-out. I simply want to show a message "You are out of frames buddy" and give a polite 2 second pause before writing the frameset.
So I'm calling detect() from the body tag to doc.write a message and pause before calling "frames()". My message is getting onscreen but function frames() won't function! If I delete my document.write message then it all works just fine?!? What on Earth am I doing wrong?
Many thanx in advance...
<script language="JavaScript">
<!--
function detect() {
if (top.frames.length==0) {
document.write('<font size="2" color="crimson" face="verdana,helvetica,sans-serif"><b>out of frames</b></font><br>');
document.write('<font size="1" color="black" face="verdana,helvetica,sans-serif">loading frameset...</font>');
timer=setTimeout('frames()',2000) }
}
function frames() {
framesetpage="awnings-frameset.html";
thispage=window.location.href;
if (thispage.indexOf('://')<0) {thispage="://"+thispage;};
prefix=thispage.substring(0,thispage.lastIndexOf('://'));
suffix=thispage.substring(thispage.lastIndexOf('://')+3,thispage.length);
// alert('the subpage is:['+prefix+']['+suffix+']');
if (parent.location.href==window.location.href) {parent.location.href=framesetpage+"?"+prefix+"&&&"+suffix};
}
// -->
</script>