学习赵老师的,在自己博客中添加Web Live Messenger对话框
http://www.cnblogs.com/JeffreyZhao/archive/2007/11/10/Add-Web-Live-Messenger-to-your-page.html
在博客园的选项->常用选项->页脚Html代码添加以下代码
Code
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
<script src="http://files.cnblogs.com/liuke209/lk.js" language="JavaScript" type="text/javascript"></script>
<div id="liveMessengerContainer" style="position:absolute;">
<div style="border: solid 1px black;
width:160;
height: 39px; cursor:pointer;
background-image: url(http://images.cnblogs.com/cnblogs_com/liuke209/Messenger_Header_bg.gif)"
id="liveMessengerThumb">
<img src="http://images.cnblogs.com/cnblogs_com/liuke209/Messenger_logo_beta.gif"
alt="使用Live Messenger联系我"
style="margin: 10px 10px 0px 9px;"/>
</div>
<table border="0" cellpadding="0" cellspacing="0" id="liveMessengerPanel">
<tr>
<td valign="top">
<img id="hideLiveMessengerPanel"
style="cursor:pointer; margin-right: 3px;"
src="http://images.cnblogs.com/cnblogs_com/liuke209/Messenger_close_sm.gif"
alt="关闭" />
</td>
<td id="msnFrame">
</td>
</tr>
</table>
</div>
<script language="javascript" type="text/javascript">
function getClientBounds()
{
var clientWidth;
var clientHeight;
if ($.browser.msie)
{
clientWidth = document.body.clientWidth;
clientHeight = document.body.clientHeight;
}
else if ($.browser.safari)
{
clientWidth = window.innerWidth;
clientHeight = window.innerHeight;
}
else if ($.browser.opera)
{
clientWidth = Math.min(window.innerWidth,document.body.clientWidth);
clientHeight = Math.min(window.innerHeight,document.body.clientHeight);
}
else
{
clientWidth = Math.min(window.innerWidth,document.documentElement.clientWidth);
clientHeight = Math.min(window.innerHeight,document.documentElement.clientHeight);
}
return { width : clientWidth, height : clientHeight };
}
function resetLiveMessengerPosition()
{
var clientBounds = getClientBounds();
var container = document.getElementById("liveMessengerContainer");
var scrollLeft = document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft;
var scrollTop = document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;
var containerLeft=scrollLeft+clientBounds.width-container.clientWidth-5;
var containerTop=scrollTop+clientBounds.height-container.clientHeight;
$("#liveMessengerContainer").css({top : containerTop + "px", left : containerLeft + "px"});
}
</script>
<script language="javascript" type="text/javascript">
$("#liveMessengerPanel").hide();
$(document).ready(function(){
CreatIframe().appendTo("#msnFrame");
$(window).scroll(resetLiveMessengerPosition);
$(window).resize(resetLiveMessengerPosition);
resetLiveMessengerPosition();
$("#liveMessengerThumb").click(function(){
$("#liveMessengerThumb").fadeOut(500, function(){
$("#liveMessengerPanel").fadeIn(500, function(){
resetLiveMessengerPosition();
});
resetLiveMessengerPosition();
});
});
$("#hideLiveMessengerPanel").click(function(){
$("#liveMessengerPanel").fadeOut(500, function(){
$("#liveMessengerThumb").fadeIn(500, function(){
resetLiveMessengerPosition();
});
resetLiveMessengerPosition();
});
});
});
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
<script src="http://files.cnblogs.com/liuke209/lk.js" language="JavaScript" type="text/javascript"></script>
<div id="liveMessengerContainer" style="position:absolute;">
<div style="border: solid 1px black;
width:160;
height: 39px; cursor:pointer;
background-image: url(http://images.cnblogs.com/cnblogs_com/liuke209/Messenger_Header_bg.gif)"
id="liveMessengerThumb">
<img src="http://images.cnblogs.com/cnblogs_com/liuke209/Messenger_logo_beta.gif"
alt="使用Live Messenger联系我"
style="margin: 10px 10px 0px 9px;"/>
</div>
<table border="0" cellpadding="0" cellspacing="0" id="liveMessengerPanel">
<tr>
<td valign="top">
<img id="hideLiveMessengerPanel"
style="cursor:pointer; margin-right: 3px;"
src="http://images.cnblogs.com/cnblogs_com/liuke209/Messenger_close_sm.gif"
alt="关闭" />
</td>
<td id="msnFrame">
</td>
</tr>
</table>
</div>
<script language="javascript" type="text/javascript">
function getClientBounds()
{
var clientWidth;
var clientHeight;
if ($.browser.msie)
{
clientWidth = document.body.clientWidth;
clientHeight = document.body.clientHeight;
}
else if ($.browser.safari)
{
clientWidth = window.innerWidth;
clientHeight = window.innerHeight;
}
else if ($.browser.opera)
{
clientWidth = Math.min(window.innerWidth,document.body.clientWidth);
clientHeight = Math.min(window.innerHeight,document.body.clientHeight);
}
else
{
clientWidth = Math.min(window.innerWidth,document.documentElement.clientWidth);
clientHeight = Math.min(window.innerHeight,document.documentElement.clientHeight);
}
return { width : clientWidth, height : clientHeight };
}
function resetLiveMessengerPosition()
{
var clientBounds = getClientBounds();
var container = document.getElementById("liveMessengerContainer");
var scrollLeft = document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft;
var scrollTop = document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;
var containerLeft=scrollLeft+clientBounds.width-container.clientWidth-5;
var containerTop=scrollTop+clientBounds.height-container.clientHeight;
$("#liveMessengerContainer").css({top : containerTop + "px", left : containerLeft + "px"});
}
</script>
<script language="javascript" type="text/javascript">
$("#liveMessengerPanel").hide();
$(document).ready(function(){
CreatIframe().appendTo("#msnFrame");
$(window).scroll(resetLiveMessengerPosition);
$(window).resize(resetLiveMessengerPosition);
resetLiveMessengerPosition();
$("#liveMessengerThumb").click(function(){
$("#liveMessengerThumb").fadeOut(500, function(){
$("#liveMessengerPanel").fadeIn(500, function(){
resetLiveMessengerPosition();
});
resetLiveMessengerPosition();
});
});
$("#hideLiveMessengerPanel").click(function(){
$("#liveMessengerPanel").fadeOut(500, function(){
$("#liveMessengerThumb").fadeIn(500, function(){
resetLiveMessengerPosition();
});
resetLiveMessengerPosition();
});
});
});
</script>
由于博客园过滤了iframe,我们需要自己创建一个.js文件,用于动态创建jframe
http://settings.messenger.live.com/Applications/CreateHtml.aspx
点击它创建自己的Msn对话框
创建 HTML->即时消息窗口->复制 HTML 并将其粘贴到您的网页上
将生一段jframe代码,将这段代码复制到.js中,用于动态生成