06. december 2005 - 22:27
Der er
4 kommentarer og
1 løsning
Messenger wannabee popup
Er der nogen der ved, hvordan man laver et popupvindue ligesom det, der kommer når man får en besked på messenger? Har set det på forskellige sites og Microsoft Exchange Server bruger det når man får en mail.
07. december 2005 - 01:08
#2
Jeg skal gerne have scriptet til at tjekke om man har fået en besked. Ca. en gang i minuttet eller sådan noget. Tænkte på at smide det ind i en iframe, der kørte i baggrunden.
Så den skal sådan set bare køre en SQL en gang i minuttet; og hvis resultatet passer, så skal popup'en vises.
Jeg har noget kode; men jeg er ikke sikker på om det virker eller hvordan jeg skal bruge det:
<!--
var windowHeight = 54;
var windowWidth = 400;
var posTop = screen.availHeight-windowHeight;
var posLeft = (screen.width-windowWidth);
var posStart = 0;
var popupPossible = (window.createPopup) ? true : false;
var dialogPossible = (window.showModelessDialog) ? true : false;
var stopDisplay = true;
var windowContent = null;
var windowLink = null;
var myNotify = null;
function startNotify(link, text)
{
windowLink = link;
if (windowLink != null)
{
windowContent = '<div onclick="top.location.href=';
windowContent = windowContent + "'";
windowContent = windowContent + windowLink;
windowContent = windowContent + "'";
windowContent = windowContent + ';">'+text+'</div>';
}
else
{
windowContent = text;
}
if (popupPossible)
{
doDisplayPopup();
}
}
function displayPopup()
{
stopDisplay = false;
posStart += 2;
if (posStart < windowHeight)
{
myNotify.show((posLeft), (screen.availHeight-posStart-1), windowWidth, posStart);
}
else
{
window.clearInterval(popupInt);
window.setTimeout("hidingPopup()",15000);
myNotify.show((posLeft), (screen.availHeight-posStart-1), windowWidth, windowHeight);
stopDisplay = true;
}
}
function hidePopup()
{
stopDisplay = false;
posStart -= 2;
if (posStart > 0)
{
myNotify.show((posLeft), (screen.availHeight-posStart-1), windowWidth, posStart);
}
else
{
window.clearInterval(popupInt);
myNotify.hide();
stopDisplay = true;
}
}
function doDisplayPopup()
{
if (stopDisplay)
{
if (popupPossible)
{
myNotify = window.createPopup();
if (windowLink != null)
{
myNotify.document.body.style.cursor = "hand";
}
myNotify.document.body.style.backgroundColor = "#D35501";
myNotify.document.body.style.border = "1px solid black";
myNotify.document.body.style.margin = "0px 0px 0px 0px";
myNotify.document.body.style.padding = "0px";
myNotify.document.body.style.font = "normal 10pt tahoma";
myNotify.document.body.style.color = "#FFFFFF";
myNotify.document.body.innerHTML = windowContent;
}
posStart = 0;
popupInt = window.setInterval("displayPopup()",35);
stopDisplay = false;
}
}
function hidingPopup()
{
if ((stopDisplay)&&(myNotify.isOpen))
{
posStart = windowHeight;
popupInt = window.setInterval("hidePopup()",35);
stopDisplay = false;
}
}
// -->
og clientside:
var url = 'URLen der skal åbnes';
var html = 'Det html der skal vises';
startNotify(url, html)
Men synes ikke lige jeg kan få det til at virke....
12. december 2005 - 21:45
#3
Hmm , jeg har en anden liggende ..
<html>
<head>
<script type="text/JavaScript">
<!--
var x = 3
var y = 1
function startClock(){
if(document.cookie != 'email=yes')
{
x = x-y
setTimeout("startClock()", 1000)
if(x==0) {
popupWinespopup_winLoad();
}
}
}
function SetCookie(cookieName,cookieValue,nDays)
{
var today = new Date();
var expire = new Date();
if (nDays==null || nDays==0) nDays=1;
expire.setTime(today.getTime() + 3600000*24*nDays);
document.cookie = cookieName+"="+escape(cookieValue)
+ ";expires="+expire.toGMTString();
}
var popupWinoldonloadHndlr=window.onload, popupWinpopupHgt, popupWinactualHgt, popupWintmrId=-1, popupWinresetTimer;
var popupWintitHgt, popupWincntDelta, popupWintmrHide=-1, popupWinhideAfter=-1, popupWinhideAlpha, popupWinhasFilters=true;
var popupWinnWin, popupWinshowBy=null, popupWindxTimer=-1, popupWinpopupBottom;
var popupWinnText,popupWinnMsg,popupWinnTitle,popupWinbChangeTexts=false;
window.onload=popupWinespopup_winLoad;
function popupWinespopup_ShowPopup(show)
{
if (popupWindxTimer!=-1) { el.filters.blendTrans.stop(); }
if ((popupWintmrHide!=-1) && ((show!=null) && (show==popupWinshowBy)))
{
clearInterval(popupWintmrHide);
popupWintmrHide=setInterval(popupWinespopup_tmrHideTimer,popupWinhideAfter);
return;
}
if (popupWintmrId!=-1) return;
popupWinshowBy=show;
elCnt=document.getElementById('popupWin_content')
elTit=document.getElementById('popupWin_header');
el=document.getElementById('popupWin');
el.style.left='';
el.style.top='';
el.style.filter='';
if (popupWintmrHide!=-1) clearInterval(popupWintmrHide); popupWintmrHide=-1;
document.getElementById('popupWin_header').style.display='none';
document.getElementById('popupWin_content').style.display='none';
if (navigator.userAgent.indexOf('Opera')!=-1)
el.style.bottom=(document.body.scrollHeight*1-document.body.scrollTop*1
-document.body.offsetHeight*1+1*popupWinpopupBottom)+'px';
if (popupWinbChangeTexts)
{
popupWinbChangeTexts=false;
document.getElementById('popupWinaCnt').innerHTML=popupWinnMsg;
document.getElementById('popupWintitleEl').innerHTML=popupWinnTitle;
}
popupWinactualHgt=0; el.style.height=popupWinactualHgt+'px';
el.style.visibility='';
if (!popupWinresetTimer) el.style.display='';
popupWintmrId=setInterval(popupWinespopup_tmrTimer,(popupWinresetTimer?1000:20));
}
function popupWinespopup_winLoad()
{
if (popupWinoldonloadHndlr!=null) popupWinoldonloadHndlr();
elCnt=document.getElementById('popupWin_content')
elTit=document.getElementById('popupWin_header');
el=document.getElementById('popupWin');
popupWinpopupBottom=el.style.bottom.substr(0,el.style.bottom.length-2);
popupWintitHgt=elTit.style.height.substr(0,elTit.style.height.length-2);
popupWinpopupHgt=el.style.height;
popupWinpopupHgt=popupWinpopupHgt.substr(0,popupWinpopupHgt.length-2); popupWinactualHgt=0;
popupWincntDelta=popupWinpopupHgt-(elCnt.style.height.substr(0,elCnt.style.height.length-2));
if (true)
{
popupWinresetTimer=true;
popupWinespopup_ShowPopup(null);
}
}
function popupWinespopup_tmrTimer()
{
el=document.getElementById('popupWin');
if (popupWinresetTimer)
{
el.style.display='';
clearInterval(popupWintmrId); popupWinresetTimer=false;
popupWintmrId=setInterval(popupWinespopup_tmrTimer,20);
}
popupWinactualHgt+=5;
if (popupWinactualHgt>=popupWinpopupHgt)
{
popupWinactualHgt=popupWinpopupHgt; clearInterval(popupWintmrId); popupWintmrId=-1;
document.getElementById('popupWin_content').style.display='';
if (popupWinhideAfter!=-1) popupWintmrHide=setInterval(popupWinespopup_tmrHideTimer,popupWinhideAfter);
}
if (popupWintitHgt<popupWinactualHgt-6)
document.getElementById('popupWin_header').style.display='';
if ((popupWinactualHgt-popupWincntDelta)>0)
{
elCnt=document.getElementById('popupWin_content')
elCnt.style.display='';
elCnt.style.height=(popupWinactualHgt-popupWincntDelta)+'px';
}
el.style.height=popupWinactualHgt+'px';
}
function popupWinespopup_tmrHideTimer()
{
clearInterval(popupWintmrHide); popupWintmrHide=-1;
el=document.getElementById('popupWin');
if (popupWinhasFilters)
{
backCnt=document.getElementById('popupWin_content').innerHTML;
backTit=document.getElementById('popupWin_header').innerHTML;
document.getElementById('popupWin_content').innerHTML='';
document.getElementById('popupWin_header').innerHTML='';
el.style.filter='blendTrans(duration=1)';
el.filters.blendTrans.apply();
el.style.visibility='hidden';
el.filters.blendTrans.play();
document.getElementById('popupWin_content').innerHTML=backCnt;
document.getElementById('popupWin_header').innerHTML=backTit;
popupWindxTimer=setInterval(popupWinespopup_dxTimer,1000);
}
else el.style.visibility='hidden';
}
function popupWinespopup_dxTimer()
{
clearInterval(popupWindxTimer); popupWindxTimer=-1;
}
function popupWinespopup_Close()
{
if (popupWintmrId==-1)
{
el=document.getElementById('popupWin');
el.style.filter='';
el.style.display='none';
if (popupWintmrHide!=-1) clearInterval(popupWintmrHide); popupWintmrHide=-1;
}
}
var popupWinmousemoveBack,popupWinmouseupBack;
var popupWinofsX,popupWinofsY;
function popupWinespopup_DragDrop(e)
{
popupWinmousemoveBack=document.body.onmousemove;
popupWinmouseupBack=document.body.onmouseup;
ox=(e.offsetX==null)?e.layerX:e.offsetX;
oy=(e.offsetY==null)?e.layerY:e.offsetY;
popupWinofsX=ox; popupWinofsY=oy;
document.body.onmousemove=popupWinespopup_DragDropMove;
document.body.onmouseup=popupWinespopup_DragDropStop;
if (popupWintmrHide!=-1) clearInterval(popupWintmrHide);
}
function popupWinespopup_DragDropMove(e)
{
el=document.getElementById('popupWin');
if (e==null&&event!=null)
{
el.style.left=(event.clientX*1+document.body.scrollLeft-popupWinofsX)+'px';
el.style.top=(event.clientY*1+document.body.scrollTop-popupWinofsY)+'px';
event.cancelBubble=true;
}
else
{
el.style.left=(e.pageX*1-popupWinofsX)+'px';
el.style.top=(e.pageY*1-popupWinofsY)+'px';
e.cancelBubble=true;
}
if ((event.button&1)==0) popupWinespopup_DragDropStop();
}
function popupWinespopup_DragDropStop()
{
document.body.onmousemove=popupWinmousemoveBack;
document.body.onmouseup=popupWinmouseupBack;
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" onLoad="startClock();">
<table width="750" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td valign="top" width="100%">
<table border="0" cellpadding="0" cellspacing="0" align="center" width="600">
<tr>
<td valign="top" width="160">
<div id="popupWin" style="display:none; background:#E0E9F8; border-right:1px solid #455690; border-bottom:1px solid #455690; border-left:1px solid #B9C9EF; border-top:1px solid #B9C9EF; position:absolute; z-index:9999; width:296px; height:130px; right:0px; bottom:0px;" onselectstart="return false;" onmousedown="return popupWinespopup_DragDrop(event);" >
<div id="popupWin_header" style="cursor:default; display:none; position:absolute; left:2px; width:290px; top:2px; height:14px; filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#FFE0E9F8', EndColorStr='#FFFFFFFF');font:11px arial,sans-serif; color:#1F336B; text-decoration:none;"><span id="popupWintitleEl">
DIN OVERSKRIFT HER !</span><span style="position:absolute; right:0px; top:0px; cursor:pointer; color:#728EB8; font:bold 12px arial,sans-serif; position:absolute; top:2px; right:3px;" onclick="popupWinespopup_Close()"onmousedown="event.cancelBubble=true;" onmouseover="style.color='#455690';"onmouseout="style.color='#728EB8';"><img src="/ny/pictures/evindPopup/popup_close.gif" border="0" alt="Luk dette vindue"></span></div>
<div id="popupWin_content" onmousedown="event.cancelBubble=true;" style="display:none; border-left:1px solid #728EB8; border-top:1px solid #728EB8;border-bottom:1px solid #B9C9EF; border-right:1px solid #B9C9EF;background:#E0E9F8; padding:2px; overflow:hidden; text-align:center;filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#FFE0E9F8', EndColorStr='#FFFFFFFF');position:absolute; left:2px; width:290px; top:25px; height:100px;">
<font face="Arial, Helvetica, sans-serif" color="#006699">
<table>
<tr>
<td>
<img src="BILLEDE STI HER">
</td>
<td>
Underoverskrift !<br>
TEKST !!!<a href="LINK !" target="_blank">LINK</a><br>
<br><font color="#006699"</font>
</td>
</tr>
</table>
</form>
</font>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Kan det bruges ? det skal self finpudses .. men grund tingene er der .. ud af det jeg kan forståe ..