Exemple simple à glisser un div sur la page:
<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>
Vous pourriez l'améliorer à vos besoins, mais cela peut être utilisé comme une idée de base pour le faire.
Erreur Le nom 'MovingContent' n'existe pas dans le contexte actuel \t E: \ Hemaa \ Form \ welcome.aspx obtenu cette erreur – TinTin
je viens sous la direction de fixer les bugs. Réessayer. La dernière erreur que j'ai corrigée était en train de changer 'ClientId => ClientID'. Maintenant, ça devrait marcher (je l'ai testé maintenant ...) – awe
Je ne reçois rien dans ma page .. après avoir exécuté la page. – TinTin