Post by Simpsons Rule on Dec 12, 2003 23:22:55 GMT -5
This will make a box apear whenever you have new messages. Place it in your Headers or Footers. Sometimes it works in one, but not the other, so experiment.
I suggest only putting the code in your Main Header/Footer, that way people will know when they have messages as soon as they visit the site. If you put it on every page, people will get a popup no matter where they go, and it can get really annoying.
This one is a more subtle code, one that I prefer:
I suggest only putting the code in your Main Header/Footer, that way people will know when they have messages as soon as they visit the site. If you put it on every page, people will get a popup no matter where they go, and it can get really annoying.
<script language="JavaScript">
/*
© Patrick Clinger 2003
All Rights Reserved.
This script may ONLY be used on message boards
hosted by ProBoards.com. Any other site found
to be utilizing this code shall be in violation
of my copyright.
This copyright notice must remain in tact when
using this script.
*/
var IE4 = (document.all) ? 1 : 0;
function findit() {
if(IE4)
if(window.document.body.createTextRange().text.match(/(\d+) are new./))
if(RegExp.$1 != 0)
newmessage(RegExp.$1);
if(window.document.body.createTextRange().text.match(/(\d+) is new./))
if(RegExp.$1 != 0)
newmessage(RegExp.$1);
}
function newmessage(num) {
if(IE4) {
if (num == '1') {
ms = 'Message';
tm = 'it';
} else {
ms = 'Messages';
tm = 'them';
}
var gotoim = confirm('You Have '+num+' New Instant '+ms+'\n\nWould you like to view '+tm+'?');
if (gotoim) {
location = '/?action=im';
}
}
}
if (location.href.indexOf('action=') == -1 && location.href.indexOf('action=login') == -1) {
findit();
}
</script>
This one is a more subtle code, one that I prefer:
<script language="JavaScript">
/*
© Patrick Clinger 2003
All Rights Reserved.
This script may ONLY be used on message boards
hosted by ProBoards.com. Any other site found
to be utilizing this code shall be in violation
of my copyright.
This copyright notice must remain in tact when
using this script.
*/
var IMtext = '0000CC'; // change this to be the color of the text you want in the box that appears
var IMbg = 'FFFFFF'; // change this to be the color of the background for the box that appears
var IMborder = 'CC0000'; // change this to be the color of the border for the box that appears
var NS4 = (document.layers) ? 1 : 0;
var IE4 = (document.all) ? 1 : 0;
function findit() {
if(IE4)
if(window.document.body.createTextRange().text.match(/(\d+) are new./))
if(RegExp.$1 != 0)
newmessage(RegExp.$1);
if(window.document.body.createTextRange().text.match(/(\d+) is new./))
if(RegExp.$1 != 0)
newmessage(RegExp.$1);
if(NS4) {
if(!window.find("Welcome Guest.") && !window.find(", 0 are new."))
newmessage();
}
}
function newmessage(num) {
if(IE4) {
document.write('<span style="filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0)"; id="imnew" style="position:absolute;top:100;width:100;height:100;" bgcolor="'+IMborder+'"><TABLE WIDTH="100" HEIGHT="100" CELLPADDING="0" CELLSPACING="1" BGCOLOR="'+IMborder+'"><TR><TD><TABLE WIDTH="100" HEIGHT="100" CELLPADDING="0" CELLSPACING="0"><TR><TD BGCOLOR="'+IMbg+'" ALIGN="CENTER"><a href="/?action=im"><FONT FACE="Verdana,Arial" SIZE="-1" COLOR="'+IMtext+'">You have <B>'+num+'</B> new message');
if(num != 1)
document.write('s');
document.write('!</A></font></TD></TR></TABLE></TD></TR></TABLE></span>')
imnew.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=0)";
fadeim(10,1);
imnew.style.left=document.body.clientWidth-105;
imnew.style.top=5;
setTimeout("fadeim(100,0)",4000);
}
if(NS4) {
newim = new Layer(100)
newim.left = document.width-105;
newim.top = 5
newim.document.write('<a href="/?action=im">You have a new instant message!</A>')
newim.document.close()
newim.visibility="show"
setTimeout('newim.visibility="hidden"',3000);
}
}
function fadeim(amount,direction) {
imnew.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+amount+")";
if(direction && amount < 100) {
setTimeout("fadeim("+(amount+10)+","+direction+")",100);
}
if(!direction) {
if(amount > 0)
setTimeout("fadeim("+(amount-10)+","+direction+")",100);
else
imnew.style.visibility='hidden';
}
}
findit();
</script>