html 代码呢!只有js 没法看!

解决方案 »

  1.   

    <style>
    html,body{
    margin: 0px;/*-- 取消页面边界 --*/
    /*-- 滚动条样式 for IE 5.5+--*/
    scrollbar-face-color: #f6f6f6;
    scrollbar-highlight-color: #ffffff;
    scrollbar-shadow-color: #cccccc;
    scrollbar-3dlight-color: #cccccc;
    scrollbar-arrow-color: #330000;
    scrollbar-track-color: #f6f6f6;
    scrollbar-darkshadow-color: #ffffff;
    /*background-color: #00B2EB;-- 页面背景 --*/
    }
    body,td,th {
    font-size: 12px;/*-- 页面字号 --*/
    color: #000000;/*-- 页面字体颜色 --*/
    font-family:Verdana, Arial, Helvetica, sans-serif;/*-- 页面字体 --*/
    }
    .Msg_Bg {
    position:absolute;
    left: 0;
    top: 0;
    width: 100%;
    height:100%;
    filter:alpha(opacity=60);
    -moz-opacity:.6;
    opacity:.6;
    background-color: #cccccc;
    z-index: 1;
    position: absolute;
    }
    .Msg_Div_Coutent {
    position:absolute;
    left: 10%;
    top: 10%;
    -moz-opacity:.6;
    opacity:.6;
    z-index: 1;
    position: absolute;
    cursor:move;
    background-color:#FF0000;
    height:100px;
    }
    </style>
    <script>
    // JavaScript Document
    function CElement(TextHtml)
    {
       var shade  = document.createElement('div');
    var shade1  = document.createElement('div');
    shade.className  = "Msg_Bg";
    shade.id    ="MsgBoxF";
    shade1.className  = "Msg_Div_Coutent";
    shade1.id   ="MsgBoxC";
    document.body.insertBefore(shade, document.getElementById("body"));
    document.body.insertBefore(shade1, document.getElementById(shade));
    var ptable = document.getElementById('shade1');
    if (shade.style.display == 'none') return;
    var ch = document.body.clientHeight, sh = document.body.scrollHeight, st=document.body.scrollTop;
    shade.style.height = (sh > ch ? sh : ch) + 'px';
    shade.style.width = document.body.clientWidth + 'px';
    //shade1.style.width = document.body.clientWidth/2 + 'px';
    var pos = [], pw;
    if (ptable) {
    pos = getPosXY(ptable);
    pw = ptable.offsetWidth || 760;
    } else {
    pw = 500;
    pos[0] = (document.body.clientWidth-pw)/2+50;
    pos[1] = (ch-(shade1.offsetHeight || 300))/2-200;
    }
    if (navigator.product && navigator.product == 'Gecko') {
    pw -= 40;
    }
    shade1.style.left = pos[0] + 'px';
    shade1.style.top = pos[1] + 'px';
    //shade1.style.height =ch/2 + 'px'; 
    if(MsgBoxC.addEventListener)
    {
        MsgBoxC.addEventListener('onMouseDown',catchFlyBar,true);
        MsgBoxC.addEventListener('onMouseUp',releaseFlyBar,true);
        
    }
    else
    {
        MsgBoxC.attachEvent('onMouseDown',catchFlyBar);
        MsgBoxC.attachEvent('onMouseUp',releaseFlyBar);
    }
            shade1.innerHTML=TextHtml;
     } 
    var bIsCatchFlyBar = false;   
    var dragClickX = 0;   
    var dragClickY = 0;   
    function catchFlyBar(e){   
        bIsCatchFlyBar = true;   
        var x=event.x+document.body.scrollLeft;   
        var y=event.y+document.body.scrollTop;   
        dragClickX=x-MsgBoxC.style.pixelLeft;   
        dragClickY=y-MsgBoxC.style.pixelTop;   
        MsgBoxC.setCapture();   
        document.onmousemove = moveFlyBar;   
    }   
    function releaseFlyBar(e){   
        bIsCatchFlyBar = false;   
        MsgBoxC.releaseCapture();   
        document.onmousemove = null;   
    }   
      
    function moveFlyBar(e){   
        if(bIsCatchFlyBar){   
            MsgBoxC.style.left = event.x+document.body.scrollLeft-dragClickX;   
            MsgBoxC.style.top = event.y+document.body.scrollTop-dragClickY;   
            } 

    </script>
    <body><script language='javascript'>CElement("123123123");</script></body>
      

  2.   

    你这个程序只能在IE里面运行虽然有
    if(MsgBoxC.addEventListener)
    {
        MsgBoxC.addEventListener('onMouseDown',catchFlyBar,true);
        MsgBoxC.addEventListener('onMouseUp',releaseFlyBar,true);
       

    但是只是个纸老虎,因为你catchFlyBar和releaseFlyBar里面的方法FF跟不兼容。而且你这个写法也是有问题的应该写成
    if(MsgBoxC.addEventListener)
    {
        MsgBoxC.addEventListener('mousedown',catchFlyBar,true);
        MsgBoxC.addEventListener('mouseup',releaseFlyBar,true);
       
    我给你修改了一下能在ie下运行

    else
    {
        MsgBoxC.attachEvent('onMouseDown',catchFlyBar);
        MsgBoxC.attachEvent('onMouseUp',releaseFlyBar);

    修改成
    else
    {
        MsgBoxC.attachEvent('onmousedown',catchFlyBar);
        MsgBoxC.attachEvent('onmouseup',releaseFlyBar);

      

  3.   

    <html>
        <style>
            html, body {
                margin: 0px; /*-- 取消页面边界 --*/
                /*-- 滚动条样式 for IE 5.5+--*/
                scrollbar-face-color: #f6f6f6;
                scrollbar-highlight-color: #ffffff;
                scrollbar-shadow-color: #cccccc;
                scrollbar-3dlight-color: #cccccc;
                scrollbar-arrow-color: #330000;
                scrollbar-track-color: #f6f6f6;
                scrollbar-darkshadow-color: #ffffff;
                /*background-color: #00B2EB;-- 页面背景 --*/
            }
            
            body, td, th {
                font-size: 12px; /*-- 页面字号 --*/
                color: #000000; /*-- 页面字体颜色 --*/
                font-family: Verdana, Arial, Helvetica, sans-serif; /*-- 页面字体 --*/
            } .Msg_Bg {
                position: absolute;
                left: 0;
                top: 0;
                width: 100%;
                height: 100%;
                filter: alpha( opacity = 60);
            
            -moz-opacity:
                .6;
            
            opacity:
                .6;
            
            background-color:
                #cccccc;
            
            z-index:
                1;
            
            position:absolute;
            } .Msg_Div_Coutent {
                position: absolute;
                left: 10%;
                top: 10%;
                -moz-opacity: .6;
                opacity: .6;
                z-index: 1;
                position: absolute;
                cursor: move;
                background-color: #FF0000;
                height: 100px;
            }
        </style>
        <script>
            // JavaScript Document
            function CElement(TextHtml){
                var shade = document.createElement('div');
                var shade1 = document.createElement('div');
                shade.className = "Msg_Bg";
                shade.id = "MsgBoxF";
                shade1.className = "Msg_Div_Coutent";
                shade1.id = "MsgBoxC";
                document.body.insertBefore(shade, document.getElementById("body"));
                document.body.insertBefore(shade1, document.getElementById(shade));
                var ptable = document.getElementById('shade1');
                if (shade.style.display == 'none') 
                    return;
                var ch = document.body.clientHeight, sh = document.body.scrollHeight, st = document.body.scrollTop;
                shade.style.height = (sh > ch ? sh : ch) + 'px';
                shade.style.width = document.body.clientWidth + 'px';
                //shade1.style.width = document.body.clientWidth/2 + 'px';
                var pos = [], pw;
                if (ptable) {
                    pos = getPosXY(ptable);
                    pw = ptable.offsetWidth || 760;
                }
                else {
                    pw = 500;
                    pos[0] = (document.body.clientWidth - pw) / 2 + 50;
                    pos[1] = (ch - (shade1.offsetHeight || 300)) / 2 - 200;
                }
                if (navigator.product && navigator.product == 'Gecko') {
                    pw -= 40;
                }
                shade1.style.left = pos[0] + 'px';
                shade1.style.top = pos[1] + 'px';
                //shade1.style.height =ch/2 + 'px';
                if (MsgBoxC.addEventListener) {
                    MsgBoxC.addEventListener('mousedown', catchFlyBar, true);
                    MsgBoxC.addEventListener('mouseup', releaseFlyBar, true);
                    
                }
                else {
                    MsgBoxC.attachEvent('onmousedown', catchFlyBar);
                    MsgBoxC.attachEvent('onmouseup', releaseFlyBar);
                }
                shade1.innerHTML = TextHtml;
            }
            
            var bIsCatchFlyBar = false;
            var dragClickX = 0;
            var dragClickY = 0;
            function catchFlyBar(e){
                e = e || window.event;
                bIsCatchFlyBar = true;
                var x = e.clientX + document.body.scrollLeft;
                var y = e.clientY + document.body.scrollTop;
                dragClickX = x - MsgBoxC.offsetLeft;
                dragClickY = y - MsgBoxC.offsetTop;
                /*@ccon MsgBoxC.setCapture(); @*/
                document.onmousemove = moveFlyBar;
            }
            
            function releaseFlyBar(e){
                bIsCatchFlyBar = false;
                /*@ccon MsgBoxC.releaseCapture(); @*/
                document.onmousemove = null;
            }
            
            function moveFlyBar(e){
                e = e || window.event;
                if (bIsCatchFlyBar) {
                    MsgBoxC.style.left = e.clientX + document.body.scrollLeft - dragClickX + "px";
                    MsgBoxC.style.top = e.clientY + document.body.scrollTop - dragClickY + "px";
                }
            }
        </script>
        <body>
            <script language='javascript'>
                CElement("123123123");
            </script>
        </body>
    </html>
      

  4.   

    lz你的FF是什么版本的?为什么我用ls的在FF下不行呀??我也想要这个效果。