如何在网站中实现移动内容/文本.在asp.net中

Tin*_*Tin 7 javascript c# asp.net

如何在网站中实现移动内容/文本,如选框.在asp.net中.

我的数据集中有值.数据集值必须像div一样显示在div中...

awe*_*awe 1

在页面上滑动 div 的简单示例:

<asp:Panel id="MovingContent" runat="server"
     style="position:absolute;left:-100px;top:20px;height:40px;width:100px;">
The content that will move
</asp:Panel>

<script type="text/javascript">

//Initial position 
//(should be the same as the position specified in the element's style)
posX = -100;
posY = 20;

//Position where the element will stop
targetX=200;
targetY=60;

function move(){
 if(posX < targetX){
  posX += 10;
  if(posY < targetY) posY += 1;
  var divElement = document.getElementById('<%=MovingContent.ClientID%>');
  divElement.style.left = posX + 'px';
  divElement.style.top = posY + 'px';

  //Time in milliseconds to when to move next step
  self.setTimeout('move()', 100); 

 }
}

move(); //Start the moving

</script>
Run Code Online (Sandbox Code Playgroud)

您可以根据自己的需要改进它,但这可以用作如何做到这一点的基本想法。