time

THỜI GIAN LÀ VÀNG

Tài nguyên dạy học

LIÊN KẾT CÁC WEBSITE

TIN TỨC ONLINE

LỊCH ÂM DƯƠNG

MÁY TÍNH ĐIỆN TỬ

Hỗ trợ trực tuyến

  • (Hoàng Đức Hòa)
  • (Lưu Hùng Sơn)
  • (Trần Thị Minh Tươi)

DANH NGÔN

Điều tra ý kiến

Bạn thấy website này thế nào
Đẹp
Đơn điệu
Bình thường
Quá xấu
Ý iến khác

Thống kê

  • truy cập   (chi tiết)
    trong hôm nay
  • lượt xem
    trong hôm nay
  • thành viên
  • Ảnh ngẫu nhiên

    Su_lon_len_va_phan_chia_cua_TB_va_mo_TV2.jpg So_do_cau_tao_te_bao_va_mo_thuc_vat1.jpg Kinh_hien_vi_va_cac_buoc_quan_sat_tbtv1.jpg Cau_tao_trong_cua_than_non3.jpg Cac_kieu_xep_la_tren_than_va_canh6.jpg Cac_dang_phien_La_va_cac_bo_phan_cua_la2.jpg Khongbaogioquenanh.swf Tieng_xua.swf Va_toi_cung_yeu_em2.swf Bai_hat_Anh_con_no_em.flv Huyen_thoai_me_MT.swf NNCTT_valentinesc.swf Valentine_2011moi.swf DIEP_KHUC_MUA_XUAN1.swf MT_833.swf HappyNewYear_MT.gif CHUC_MUNG_NAM_MOI.jpg Giang_sinh_6.gif 20111.gif

    Thành viên trực tuyến

    1 khách và 0 thành viên

    Sắp xếp dữ liệu

    DU LỊCH VIỆT NAM

    LỊCH TRUYỀN HÌNH

    Gốc > CODE >

    Code tạo ảnh trượt 2 bên trang web, blog

     

    Hôm nay ĐTN BLOG xin gửi đến quý thầy cô đoạn code tạo ảnh trượt 2 bên trang web, blog như của trang này. Các bạn sửa theo hướng dẫn rồi copy vào khối chính hoặc khối chức năng đều được. Ảnh hiển thị tốt hơn ở trình duyệt Firefox và Google Chrome

    <html>

        <head>

            <title>uoon demo Set Position</title>

        <style type="text/css">

        .float {

            width: 115px;

            height: 200px;

            border: solid 1px blue;

        }

     

        </style>

        </head>

        <body>

            <div style="width: 0px;height: 0px;">

                <div id="a" class="float"><a href=" Link địa chỉ bạn muốn dẫn đến khi bấm chuột vào ảnh phải "><img src=' Link của ảnh sẽ hiển thị bên phải '></div>

                            <div id="c" class="float"><a href=" Link địa chỉ bạn muốn dẫn đến khi bấm chuột vào ảnh trái"><img src=' Link của ảnh sẽ hiển thị bên trái '></div>

            </div>

        </body>

     

        <script type="text/javascript">

          

            function setPosition(id, position) {

              

                var store = {

                    ram : {

                        top : 0,

                        left : 0,

                        right : 0,

                        bottom : 0

                    },

                    rom : {

                        top : null,

                        left : null,

                        right : null,

                        bottom : null

                    }

                };

              

              

                for (var i in position) {store.rom[i] = position[i];}

              

                var element = document.getElementById(id);

              

                for (i in store) {element[i] = store[i];}

               

                element.rom.move = function() {

                  

                    if (window.innerHeight) {

                        var topPage = window.pageYOffset;

                        var leftPage = window.pageXOffset;

                        var rightPage = leftPage + window.innerWidth - element.offsetWidth;

                        var bottomPage = topPage + window.innerHeight - element.offsetHeight;

                    }

                    else {

                        var topPage = document.body.scrollTop;

                        var leftPage = document.body.scrollLeft;

                        var rightPage = leftPage + document.body.clientWidth - element.offsetWidth;

                        var bottomPage = topPage + document.body.clientHeight - element.offsetHeight;

                    }

                            element.style.position = "absolute";

                  

                    if (element.rom.top != null) {

                        element.ram.top += Math.round((topPage + element.rom.top - element.ram.top)/20);

                        element.style.top = element.ram.top;

                    }

                    if (element.rom.left != null) {

                        element.ram.left += Math.round((leftPage + element.rom.left - element.ram.left)/20);

                        element.style.left = element.ram.left;

                    }

                    if (element.rom.right != null) {

                        element.ram.right += Math.round((rightPage - element.rom.right - element.ram.right)/20);

                        element.style.left = element.ram.right;

                    }

                    if (element.rom.bottom != null) {

                        element.ram.bottom += Math.round((bottomPage - element.rom.bottom - element.ram.bottom)/20);

                        element.style.top = element.ram.bottom;

                    }

                                  setTimeout("document.getElementById('"+element.id+"').rom.move()",10);

                          };  

                          element.rom.move();

            }

                  setPosition("a", {top: 20, right: 30});

           

            setPosition("c", {top: 20, left: 30});

               </script>

        </body>

        </html>


    Nhắn tin cho tác giả
    Hoàng Đức Hòa @ 19:58 09/01/2011
    Số lượt xem: 1094
    Số lượt thích: 0 người
     
    Gửi ý kiến

    KIỂM TRA CODE