473,795 Members | 3,393 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Off-Screen Moving Objects Javascript - possible?

pavlov
1 New Member
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 2362
acoder
16,027 Recognized Expert Moderator MVP
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
12462
by: Frank | last post by:
Whats best : register_globals ON ? OR register_globals OFF ? I currently use: $_POST
7
2036
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
7430
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 in OFF format and store the values read in some file format, I suppose in arrays of floats or ints would be meaningful: My general idea:
2
9018
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 at a page level. Any ideas/thought would be greatly appreciated. Thanks in advance, Zac
33
2521
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 want to see off-topic discussions posting off-topic messages complaining about the lack of topicality! Messages saying *PLONK* are also off-topic, but the complainers sem to post those a lot as well. If all of the people who currently complain...
4
23519
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 when you are logged on and the prompt is: db2 => Here's an example how I do it from Command Window (option is c):
6
2051
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 Administrator account and then quits itself. 3. Application X2 does a couple of things, then restarts Application X1 using the regular User account, then Application X2 quits itself.
8
2427
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 man in question, in "Option Strict On" by default. Actually I don't believe I have code where this is not the case.
0
2291
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 everyday,At the same time it should not log off other users.Say, if A and B are the users ,then only A has to be loggef off .Also it should display an alert window before logging off. Following pop up msg has to be displayed ''you are going to log off ,plz...
6
1591
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 a bold step I decided to attempt to set viewstate on the form itself off which had a massive impact on the viewstate like 80K to 15k. So my question is what is the significance of turning off the viewstate for the form and what information...
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10437
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10214
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10164
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10001
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3723
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.