【分享】Web的桌面提醒(Popup,类似msn,outlook等的信息提示)

singlepine 2005-09-08 04:32:39
昨晚加班,无意找到一些类似msn,outlook等的信息提示的资料,今天把它整理了一下,然后自己测试通过,先分享出来,如果大伙在发送邮件或需要弹出信息对话框时,可以做个参考,也希望这段代码能越来越好,大家多提意见。
1.建立PopupManager.js,代码如下
// 队列
function Queue()
{
var items = new Array();
var first = 0;
var count = 0;
// 队列大小
this.Count = function()
{
return count;
} ;
// 取队列头/尾
this.Peek = function(last)
{
var result = null;
if (count > 0)
{
if (null != last && true == last)
result = items[first + (count - 1)];
else
result = items[first];
}
return result;
};
// 入列
this.Enqueue = function(x)
{
items[first + count] = x;
count++;
return x;
};

// 出列
this.Dequeue = function()
{
var result = null;
if (count > 0)
{
result = items[first];
delete items[first];
first++;
count--;
}
return result;
};
}
var newlineRegExp = new RegExp("(\r\n|\n|\r)", "g");
function NewlineReplace(str)
{
result = "";
if (str != null)
result = str.replace(newlineRegExp, "<br>");
return result;
}

var entityList = new Array();
entityList["<"] = "<";
entityList["\uff1c"] = "<";
entityList[">"] = ">";
entityList["\uff1e"] = ">";
entityList["&"] = "&";
entityList["\uff06"] = "&";
entityList["\""] = """;
entityList["\uff02"] = """;

function EntityReplace(str)
{
var result = "";
if (str != null)
{
var len = str.length;
var i = 0;
while (i < len)
{
var j = i;
var e = entityList[str.charAt(j)];
while (j < len && null == e)
{
j++;
e = entityList[str.charAt(j)];
}
result += str.substr(i, j - i);
if (e != null)
{
result += e;
j++;
}
i = j;
}
}
return result;
}

function GetPopupCssText()
{
var styles = document.styleSheets;
var csstext = "";
for(var i=0; i<styles.length; i++)
{
if (styles[i].id == "popupmanager")
csstext += styles[i].cssText;
}
return csstext;
}

function PopupWin(winID)
{
this.Win = document.getElementById(winID);
this.Menu = document.getElementById(winID + "_Menu");
this.Icon = document.getElementById(winID + "_Icon");
this.MenuButton = document.getElementById(winID + "_MenuButton");
this.CloseButton = document.getElementById(winID + "_CloseButton");
this.Caption = document.getElementById(winID + "_Caption");
this.CaptionText = document.getElementById(winID + "_CaptionText");
this.Body = document.getElementById(winID + "_Body");
this.BodyText = document.getElementById(winID + "_BodyText");
}

function Popup(winID, message, icon, title, func)
{
this.PostID;
this.URL;
this.Type = "Mail"; // Mail,Thread,Post,Message
this.win = new PopupWin(winID);
this.popup = null;
this.popupMenu = null;
this.PopupManager = null;
this.showTime = null;
this.func = func;
this.isMouseOver = false;
this.CreateBody = Popup_CreateBody;
this.Close = Popup_Close;
this.Hide = Popup_Hide;
this.Show = Popup_Show;
this.ShowTime = Popup_ShowTime;
this.aspxl = this.CreateBody(message, icon, title);
}

function Popup_Close()
{
if (this.popup != null)
this.popup.document.onmouseover = null;
else
this.win.Win.onmouseover = null;

this.isMouseOver = false;
this.ShowTime = function()
{
return 7;
}
this.Hide();
}
...全文
1976 31 打赏 收藏 转发到动态 举报
写回复
用AI写文章
31 条回复
切换为时间正序
请发表友善的回复…
发表回复
ahcsdn 2006-07-07
  • 打赏
  • 举报
回复
我还mark 一下
shankaipingo 2006-06-16
  • 打赏
  • 举报
回复
Great!!!
boylez 2006-05-23
  • 打赏
  • 举报
回复
m
michaelowenii 2006-02-21
  • 打赏
  • 举报
回复
我还mark 一下
weiqj8686 2006-02-17
  • 打赏
  • 举报
回复
thank you!
junhao_666 2006-01-04
  • 打赏
  • 举报
回复
kofkyo 2006-01-03
  • 打赏
  • 举报
回复
I like it
L_dreamer 2005-09-21
  • 打赏
  • 举报
回复
mark
yejunyan 2005-09-15
  • 打赏
  • 举报
回复
好文,收藏学习!
hchxxzx 2005-09-12
  • 打赏
  • 举报
回复
你要先结贴,然后才能添加到FAQ。
renyu732 2005-09-09
  • 打赏
  • 举报
回复
up
pclogic 2005-09-09
  • 打赏
  • 举报
回复
感谢楼主分享
qq801221 2005-09-09
  • 打赏
  • 举报
回复
谢谢老大
稍微有点无敌 2005-09-09
  • 打赏
  • 举报
回复
to singlepine (小山)
能把相关的图片发给我吗?
jrt324@126.com
zhuyunping 2005-09-09
  • 打赏
  • 举报
回复
收藏^0^
joinu 2005-09-09
  • 打赏
  • 举报
回复
这样的东西 值得收藏
pwqzc 2005-09-09
  • 打赏
  • 举报
回复
无论怎么样
当web窗体失去焦点的时候他就不能够popup
如果当web窗体失去焦点的时候也能够popup就好拉
whispers 2005-09-09
  • 打赏
  • 举报
回复
感谢楼主分享
稍微有点无敌 2005-09-09
  • 打赏
  • 举报
回复
好东东!!
谢谢!收藏!!
yeskele 2005-09-09
  • 打赏
  • 举报
回复
恩,好东西一定要收藏的
加载更多回复(11)
内容概要:本文围绕不确定环境下的多式联运路径优化问题展开研究,提出并实现了基于AFO算法、遗传算法(GA)和粒子群优化算法(PSO)的三种智能优化方法,并借助Matlab平台完成算法编程与仿真。研究构建了考虑时间、成本、转运风险等多重不确定因素的路径优化模型,系统比较了AFO、GA、PSO三种算法在收敛速度、全局寻优能力和稳定性方面的表现,同时引入Matlab自带的全局优化搜索器作为基准对照,深入分析各算法在复杂物流网络中的适用边界与性能差异。研究表明,AFO算法在解决此类组合优化问题时展现出更快的收敛效率和更强的局部规避能力。; 适合人群:具备一定Matlab编程基础与运筹优化知识,从事物流工程、交通运输规划、智能算法开发等相关领域的研究生、科研人员及工程技术人员。; 使用场景及目标:①应用于多式联运、综合货运网络中的路径决策支持系统构建;②为不确定性条件下复杂路径规划问题提供智能算法选型依据与技术实现方案;③支持科研人员复现主流优化算法并开展横向性能对比实验,推动算法改进与实际落地。; 阅读建议:建议读者结合提供的Matlab代码逐模块分析算法实现流程,重点理解目标函数设计、约束条件处理及参数敏感性分析部分,可通过调整问题规模与算法参数进行对比实验,进一步拓展至动态路径规划或大规模网络优化等延伸场景。

62,272

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧