2008年6月15日 星期日

msn即時熱線 範例教學

msn即時熱線 範例教學

範例程式碼請參考

http://www.wahahajk.com/nclab/msn.aspx

結合MSN和Yahoo YUI的Api 即時顯示MSN狀態 讓使用者能不登入MSN帳號匿名傳訊給我可自由縮放大小拖拉位置(MSN即時熱線有時明明有登入卻永遠顯示離線 多嘗試關掉MSN重登幾次就會正常)

以下節錄部份範例程式碼



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="msn.aspx.cs" Inherits="msn" %>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<html xmlns="http://www.w3.org/1999/xhtml" >

<head id="Head1" runat="server">

    <title>MSN即時熱線範例</title>

    <%--引用Yahoo YUI--%>

    <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.2/build/assets/skins/sam/resize.css" />  

    <script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/yahoo-dom-event/yahoo-dom-event.js"></script>   

    <script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/dragdrop/dragdrop-min.js"></script>   

    <script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/element/element-beta-min.js"></script>   

    <script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/animation/animation-min.js"></script>   

    <script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/resize/resize-beta-min.js"></script>  

    <script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/yuiloader/yuiloader-beta-min.js"></script>

    <script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/dom/dom-min.js"></script>

    <script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/event/event-min.js"></script>

    <script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/button/button-min.js"></script>

</head>

 

<body class="yui-skin-sam">

    <form id="form1" runat="server">

    <div>

        <%-- 宣告容器圖層 --%>  

        <div id="msnOuter" style="border: solid 0px; width: 400px; height: 400px;position: absolute;">

            <div id="banner" class="data" style="border: solid 0px; width: 100%; height: 60%; position: absolute;">

                <%--可拖拉的位置--%>

            </div>

            <div id="msnInner" style="border: solid 0px; width: 100%; height: 100%;">

                <%--msn主體--%>

                <iframe src="http://settings.messenger.live.com/Conversation/IMMe.aspx?invitee=b7cc3e1bfc9d2b78@apps.messenger.live.com&mkt=zh-tw&useTheme=true&foreColor=444444&backColor=FFD5D5&linkColor=444444&borderColor=ED7B7B&buttonForeColor=AA3636&buttonBackColor=FAD6D6&buttonBorderColor=AA3636&buttonDisabledColor=FAD6D6&headerForeColor=444444&headerBackColor=F9A3A3&menuForeColor=E45A5A&menuBackColor=FFFFFF&chatForeColor=444444&chatBackColor=FEF6F6&chatDisabledColor=F6F6F6&chatErrorColor=760502&chatLabelColor=6E6C6C" width="100%" height="100%" style="border: solid 1px black; width: 100%; height: 100%;" frameborder="0" id="IFRAME1"></iframe>

            </div>

        </div>

       

        <script type="text/javascript">

        (

            function()

            {                

                var Dom = YAHOO.util.Dom,Event = YAHOO.util.Event;   

                var resize = new YAHOO.util.Resize("msnOuter",

                    {

                        handles: 'br',//resize控制項放在右下角

                        minWidth: 175,//最小寬度

                        minHeight: 250,//最小高度

                        proxy: true,//移動不會立即顯示 會先顯示圖框

                        draggable: true,//resizeable內建的drag功能

                        animate: true,//移動的過場動畫

                        animateDuration: .75,

                        animateEasing: YAHOO.util.Easing.backBoth

                    }

                );

            }

        )

        ();

        </script>

    </div>

    </form>

 

 <style type="text/css">

    /* Bottom Right Gripper 把右下角的圖放大點*/

    .yui-skin-sam .yui-resize .yui-resize-handle-br {

        height: 20px;  

        width: 20px;  

        background-position: -20px -60px;

        background-color: transparent; 

    }

</style>

</body>

</html>