asp.net 长表单填写水平滚动条滑动效果

暖枫无敌 2012-04-05

javascript css Server c# asp index html type

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="GrowthMonitor.WebForm1" %>

<!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 runat="server">
    <title></title>
    <script src="../_rec/Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <style type="text/css">
        #nav
        {
            position: fixed;
            top: 5px;
            right: 10px;
        }
        #nav span
        {
            margin-left: 10px;
            cursor: pointer;
        }
    </style>
    <!--[if IE 6]>
        <style type="text/css">
            #nav{position:absolute;width:200px;right:auto;left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft,10)||0)-(parseInt(this.currentStyle.marginRight,10)||0));}
        </style>
    <![endif]-->
    <script type="text/javascript">
        $(function () {
            var posArray = [300, 700, 1000, 1500];
            var siteName = getCurrentSiteName();
            var index = 0;
            var span_width = 0;

            $(".table-nav span").each(function (i) {
                $(this).click(function () {
                    $(document).scrollLeft(posArray[i]);
                    if (i == 0) {
                        span_width = 750;
                    } else if (i == 1) {
                        span_width = 1300;
                    } else if (i == 2) {
                        span_width = 1850;
                    } else if (i == 3) {
                        span_width = 2300;
                    }
                    $("#btnFollow").css("left", span_width + "px");
                    $("#go" + i).css("color", "red").siblings().css("color", "black");
                });
            });

            if (siteName  == "百度") {
                index = 0;
                span_width = 750;
                $("#go0").css("color", "red");
            } else if (siteName  == "谷歌") {
                index = 1;
                span_width = 1300;
                $("#go1").css("color", "red");
            } else if (siteName  == "新浪") {
                index = 2;
                span_width = 1850;
                $("#go2").css("color", "red");
            } else if (siteName  == "腾讯") {
                index = 3;
                span_width = 2300;
                $("#go3").css("color", "red");
            }
            $("#btnFollow").css("left", span_width + "px");
            $(document).scrollLeft(posArray[index]);
        });

        //获取当前门户名称
        function getCurrentSiteName() {
            var obj = SiteMonitor.Enter.Index.getCurrentSiteName();
            return obj.value;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="nav">
        <span id="go0">百度</span><span id="go1">谷歌</span><span id="go2">新浪</span><span id="go3">腾讯</span>
    </div>
    <table width="2500px">
        <tr>
            <td style="width:500px">百度</td>
            <td style="width:500px">谷歌</td>
            <td style="width:500px">新浪</td>
            <td style="width:500px">腾讯</td>
        </tr>
        <tr>
            <td style="width:500px">百度</td>
            <td style="width:500px">谷歌</td>
            <td style="width:500px">新浪</td>
            <td style="width:500px">腾讯</td>
        </tr>
        <tr>
            <td style="width:500px">百度</td>
            <td style="width:500px">谷歌</td>
            <td style="width:500px">新浪</td>
            <td style="width:500px">腾讯</td>
        </tr>
        <tr>
            <td style="width:500px">百度</td>
            <td style="width:500px">谷歌</td>
            <td style="width:500px">新浪</td>
            <td style="width:500px">腾讯</td>
        </tr>
        <tr>
            <td style="width:500px">百度</td>
            <td style="width:500px">谷歌</td>
            <td style="width:500px">新浪</td>
            <td style="width:500px">腾讯</td>
        </tr>
        <tr>
            <td style="width:500px">百度</td>
            <td style="width:500px">谷歌</td>
            <td style="width:500px">新浪</td>
            <td style="width:500px">腾讯</td>
        </tr>
    </table>
    <div id="btnFollow" style="position: absolute; width: 200px;">
      <input type="button" value="bao"/> 
   </div>
   </form>
</body>
</html>


登录 后评论
下一篇
云栖号资讯小编
5249人浏览
2020-07-13
相关推荐
超强1000个jquery插件!
2119人浏览
2011-12-18 20:29:00
ASP.NET实用技巧
603人浏览
2008-12-02 15:11:00
CSS-返回顶部代码
1187人浏览
2017-07-06 11:03:00
36个引人注目JQuery导航菜单
803人浏览
2009-12-14 11:58:00
jquery 导航
1553人浏览
2013-01-10 10:05:00
36个引人注目JQuery导航菜单
772人浏览
2009-12-14 11:58:00
0
0
0
555