473,405 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Pb to moving a layer ...

Hello every body

When I do a loop to move a layer, I have only the final position
In this exemple, I forget Netscape Javascript codes to simplify it

//********************
<HTML>
<HEADER>
<script Language="Javascript">
function moveLayer(MyLayer) {
var x=0;
var y=1;
var delay=0;
var TIMEDELAY=10000;
for (x=10 ; x<200 ; x+=1) {
document.all[MyLayer].style.left = x;
document.all[MyLayer].style.top = x;
for (delay=0 ; delay<TIMEDELAY ; delay++) ; // (juste to build a
small pause )
}
}
</script>

</HEADER>
<BODY>

<div id="theLayer"
style="position:absolute;top:400;width:150px;visib ility:visible">Move-Me
!!!</div>

<script Language="Javascript">
moveLayer("theLayer");
</script>
</BODY>
</HTML>
Jul 20 '05 #1
1 1175
Antoine FESSARD wrote:
When I do a loop to move a layer, I have only the final position
In this exemple, I forget Netscape Javascript codes to simplify it

//********************
<HTML>
<HEADER>
<script Language="Javascript">
function moveLayer(MyLayer) {
var x=0;
var y=1;
var delay=0;
var TIMEDELAY=10000;
for (x=10 ; x<200 ; x+=1) {
document.all[MyLayer].style.left = x;
document.all[MyLayer].style.top = x;
for (delay=0 ; delay<TIMEDELAY ; delay++) ; // (juste to build a
small pause )
}


Tight loops are certainly not an appropriate way to force a delay
since they depend on the processing speed of the executing system
and may still be removed by internal optimization. Instead, one
should set a timeout/interval (using the setTimeout/setInterval
method) to specify that an action (such as an animation) should
proceed/take place on specified timestamps from the time of setting.

Besides, your code is far from being valid HTML.
You cannot run on a swamp: <http://validator.w3.org/>
PointedEars
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: PAD | last post by:
I have written a javascript routine that populates a parent document with a series of <iframe>s. Each <iframe> receives its contents from a series of separate smaller HTML files. Of course my NN...
0
by: Victor Bastiaansen | last post by:
For use in a menu I build a stylesheet which crops an image which contains both the normal button-state and the mouseover-state. On a mouseover the layer background-images 'moves', and another part...
1
by: rbg | last post by:
Hi, I am trying to understand the layering concept with the ASP.NET 2.0 apps. I have a ASP.NET 2.0 Web app which has 3 layers Presentation layer which contains UI elements and Input...
1
by: VMI | last post by:
I'm working on an web app and I'm interested in moving a TextBox from one position in the page to another (in the same page) when a user clicks on a checkbox (i.e. display additional textbox when...
16
by: MS newsgroup | last post by:
I don't have clear reasons why we need business logic layer and data logic layer instead of having only data logic layer. Are there any good reasons for that?
7
by: raylaur | last post by:
I'm using a javascript "slide" function to move a <div> layer in 10 pixel increments from one location on a page to another. The layer contains a GIF image. It's basically a side panel that flies out...
8
by: Chris Asaipillai | last post by:
Hi there I have some questions for those experienced Visual Basic 6 programmers out there who have made the transition from VB6 to Vb.net. How long did it take you to learn at least the basic...
3
by: ujjc001 | last post by:
Ok, I know why it happens, but I don't know how to fix it. I've got code that responds to a user clicking an up or down arrow button which moves a div layer down or up into a placeholder div...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.