473,323 Members | 1,547 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,323 software developers and data experts.

Off-Screen Moving Objects Javascript - possible?

pavlov
1
Hello everybody.
I've this problem: I'm making a jpg moving horizontally from left to right in my page. I'd like to make it start moving from the left off-screen side. I tried using position negative values either defining the <style> of the img object or in the Javascript function that produces the image movement, but it doesn't work. The starting point from the images is always on screen.
Anybody can turn on the light??

Thanks!


This is the Js File:

Expand|Select|Wrap|Line Numbers
  1. var timer1;
  2.  
  3. function iecompattest(){
  4. return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
  5. }
  6.  
  7. function Chip(chipname,width,height){
  8. this.named=chipname;
  9. this.xx=(-495);
  10. this.yy=208;
  11. this.timer1=null;
  12. }
  13.  
  14. function movechip(chipname){
  15. if (document.getElementById){
  16. eval("chip="+chipname);
  17. if (window.innerWidth || window.opera){
  18.  
  19. pageY=window.pageYOffset;
  20. pageH=window.innerHeight;
  21. }
  22. else if (document.body){
  23. pageY=iecompattest().scrollTop;
  24. pageH=iecompattest().offsetHeight;
  25. }
  26.  
  27.  
  28. while(chip.xx<250){
  29. chip.xx=chip.xx+5;}
  30. if (chip.xx<=420)
  31. {
  32. chip.xx=chip.xx+5;
  33. }
  34. else
  35. chip.xx=chip.xx;
  36. document.getElementById(chip.named).style.left=chip.xx+"px";
  37.  
  38.  
  39.  
  40. chip.timer1=setTimeout("movechip('"+chip.named+"')",50);
  41. }
Jul 19 '07 #1
1 2338
acoder
16,027 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. while(chip.xx<250){
  2. chip.xx=chip.xx+5;}
would loop until 250, so xx can never be negative.
Jan 8 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Frank | last post by:
Whats best : register_globals ON ? OR register_globals OFF ? I currently use: $_POST
7
by: Agent Mulder | last post by:
Hi group, I thought it might be a good idea to come up with a tagging system for off-topic posts, Borland style. So instead of the 'generic' Soundcard crashed under VC6.0 we would have
2
by: Alexander Schmidt | last post by:
Hi, I am not very familiar with C++ programming, so before I do a dirty hack I ask for a more elegant solution (but only the usage of STL is allowed, no special libs). So I need to read a file...
2
by: scorp7355 | last post by:
I was wondering if there is some other way to turn autocomplete off besides using "autocomplete=off", using a meta tag or something similar. It would be great if there is some way to turn it off...
33
by: Chris Croughton | last post by:
I notice the real reason for not posting "off-topic" here is that the result will be a long thread on whether the matter is off-topic or not -- caused by the very people who claim that they don't...
4
by: no_spam_for_gman | last post by:
Hi, I can turn off autocommit within the command window but I cannot figure out how to turn it off when you are in the IBM DB2 Command Line Processor. Does anybody knows how? By the way I mean...
6
by: Frank Rizzo | last post by:
I have the following situation: 1. Application X1 runs under a regular user account (this user is also the currently logged on user). 2. Application X1 kicks off Application X2 using an...
8
by: Rory Becker | last post by:
A wise man once said: "Never put off until runtime what you can fix at compile time." Actually I think he said it about 10 minutes before I started this post. I am a firm believer, like the...
0
by: scooby dooby | last post by:
Hi All, I need to write a script for windows,which has the requirements as below. 1,It should log out the particuler user from windows at a particuler time ,say 6 o'clock in the evening...
6
by: Rain | last post by:
Hi, I noticed the other day when I was trying to optimise the traffic on a particular web page that it had significant viewstate even though I had turned it off for most of the controls. So in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.