C# 怎么动态获得图片,并让图片上下滚动?

解决方案 »

  1.   

    http://zhidao.baidu.com/question/98198765.html
      

  2.   

    图片连续滚动的解决方法先来认识一下几个参数:innerHTML:设置或获取位于对象起始和结束标签内的 HTML
    scrollHeight: 获取对象的滚动高度。 
    scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
    scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
    scrollWidth:获取对象的滚动宽度
    offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度
    offsetLeft:获取对象相对于版面或由 offsetParent 属性指定的父坐标的计算左侧位置
    offsetTop:获取对象相对于版面或由 offsetTop 属性指定的父坐标的计算顶端位置 
    offsetWidth:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的宽度
    图片上下连续滚动<table border=1><tr><td><div id="marquees">
    <a href="#">链接一</a><br>
    <br>
    <a href="#">链接二</a><br>
    <br>
    <a href="#">链接三</a><br>
    <br>
    <a href="#">链接四</a><br>
    <br>
    </div></td></tr></table>
    <script language="JavaScript">marqueesHeight=200;
    stopscroll=false;with(marquees){
    style.width=0;
    style.height=marqueesHeight;
    style.overflowX="visible";
    style.overflowY="hidden";
    noWrap=true;
    onmouseover=new Function("stopscroll=true");
    onmouseout=new Function("stopscroll=false");
    }
    document.write('<div id="templayer" style="position:absolute;z-index:1;visibility:hidden"></div>');preTop=0; currentTop=0; function init(){
    templayer.innerHTML="";
    while(templayer.offsetHeight<marqueesHeight){
        templayer.innerHTML+=marquees.innerHTML;
    }
    marquees.innerHTML=templayer.innerHTML+templayer.innerHTML;
    setInterval("scrollUp()",10);
    }
    document.body.onload=init;function scrollUp(){
    if(stopscroll==true) return;
    preTop=marquees.scrollTop;
    marquees.scrollTop+=1;
    if(preTop==marquees.scrollTop){
        marquees.scrollTop=templayer.offsetHeight-marqueesHeight;
        marquees.scrollTop+=1;
    }
    }
    </script>图片左右连续滚动<div style="width:200px;overflow:hidden">
    <div style="position:relative;top:0px;left:0px;white-space:nowrap" id=news>
    <span id=nbo><B><font color="#22FF22">知</font><font color="#FF2222">往</font><font color="#001199">观</font><font color="#00fffa">来</font></B><B><font color="#22FF22">观</font><font color="#FF2222">往</font><font color="#001199">知</font><font color="#00fffa">来</font></B></span>
    <script language=javascript>
    //重复一次新闻内容
    document.write(nbo.innerHTML);
    </script>
    </div>
    </div>
    <script language=javascript>
    //实现不间断滚动
    function newsScroll()
    {
    news.style.pixelLeft=(news.style.pixelLeft-1)%nbo.offsetWidth;
    }
    timer1=setInterval('newsScroll()',10) //更改第二个参数可以改变速度,值越小,速度越快。
    </script>
      

  3.   

    【Repeater 夹在就是动态的内容】
    <li class="fir2" id="icefable2">
                        <div id="box16left2" class="webwidget_slideshow_common">
                            <asp:Repeater ID="memberdata" runat="server">
                                <ItemTemplate>
                                    <div class="fir2a">
                                        <ul>
                                            <li class="fir2_1"><a href="/Agent/Index.aspx?userid=<%#Eval("userid")%>" target="_blank">
                                                <img src="<%#Eval("userphoto").ToString()==""?"/images/pc_deflaut.gif":SW.Common.UitlStr.PicMinfileExtension(Eval("userphoto").ToString())%>"
                                                    alt="<%#Eval("FullName") %>" /></a></li>
                                            <li class="fir2_2"><a href="/Agent/Index.aspx?userid=<%#Eval("userid")%>" target="_blank">
                                                <b>
                                                    <%#Eval("FullName") %>
                                                </b></a>
                                                <br>
                                                <%# SW.Common.UitlStr.CutString(Eval("honor").ToString(),27,"...")%>
                                            </li>
                                        </ul>
                                    </div>
                                </ItemTemplate>
                            </asp:Repeater>
                        </div>
                        <div id="box16left3">
                        </div>
                    </li>        <style type="text/css">
    <!--
    #icefable2 {
    background: #FFF;
    overflow:hidden;
    height: 110px;
    text-align: center;
    float: left;
    margin:auto;
    }#icefable2 aaa{
        border: 3px solid #F2F2F2;
        display: block;
    }
    -->
    </style><script type="text/javascript">
    var speed=10; //数字越大速度越慢
    var tab=document.getElementById("icefable2");
    var tab1=document.getElementById("box16left2");
    var tab2=document.getElementById("box16left3");
    tab2.innerHTML=tab1.innerHTML; //克隆demo1为demo2
    function Marquee(){
        if(tab2.offsetTop-tab.scrollTop<=0){//当滚动至demo1与demo2交界时
        tab.scrollTop-=tab1.offsetHeight //demo跳到最顶端
        }else{
        tab.scrollTop++
        }
    }
    var MyMar=setInterval(Marquee,speed);
    tab.onmouseover=function() {clearInterval(MyMar)};//鼠标移上时清除定时器达到滚动停止的目的
    tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};//鼠标移开时重设定时器
                    </script>
    我的虽能获取到,但是只能实现一半的翻滚!到头了后就Stop了!