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

No Properties error (Help!)

MsNova
2
I am getting an error ‘pic1 has no properties in this code’, which is supposed to float a gif file (alien.gif in this case) around the screen. The code works fine in IE, but in Netscape and Firefox I get the following error:

Error: pic1 has no properties
Line: 66
Which is this line:
pic1.moveTo((x+pageXOffset),(y+pageYOffset))

I thought pic1 was defined with this line in the header:
var pic1=eval('document.'+_all+'pic1'+_style);
(Scratching head)

I have pasted the code below. Any help anyone can lend would be greatly appreciated.
Thanks.
-MsNova
PS I did not write this code originally I'm just trying to get it to run.

[HTML]<html>
<HEAD>

<meta http©equiv="Content©Language" content="en©us"><meta http©equiv="Content©Type" content="text/html; charset=windows©1252">



<SCRIPT LANGUAGE="JavaScript">

var isNS = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 4));
var _all = '';
var _style = '';
var wwidth, wheight;
var ydir = '++';
var xdir = '++';
var id1, id2, id3;
var x = 1;
var y = 1;
var x1, y1;
var pic1=eval('document.'+_all+'pic1'+_style);

if(!isNS) {
_all='all.';
_style='.style';
}
function getwindowsize() {
clearTimeout(id1);
clearTimeout(id2);
clearTimeout(id3);
if (isNS) {
wwidth = window.innerWidth - 55;
wheight = window.innerHeight - 50;
} else {
wwidth = document.body.clientWidth - 55;
wheight = document.body.clientHeight - 50;
}
id3 = setTimeout('randomdir()', 20000);
animate();
}
function randomdir() {
if (Math.floor(Math.random()*2)) {
(Math.floor(Math.random()*2)) ? xdir='--': xdir='++';
} else {
(Math.floor(Math.random()*2)) ? ydir='--': ydir='++';
}
id2 = setTimeout('randomdir()', 20000);
}
function animate() {
eval('x'+xdir);
eval('y'+ydir);
if (isNS) {
pic1.moveTo((x+pageXOffset),(y+pageYOffset))
} else {
pic1.pixelLeft = x+document.body.scrollLeft;
pic1.pixelTop = y+document.body.scrollTop;
}
if (isNS) {
if (pic1.top <= 5+pageYOffset) ydir = '++';
if (pic1.top >= wheight+pageYOffset) ydir = '--';
if (pic1.left >= wwidth+pageXOffset) xdir = '--';
if (pic1.left <= 5+pageXOffset) xdir = '++';
} else {
if (pic1.pixelTop <= 5+document.body.scrollTop) ydir = '++';
if (pic1.pixelTop >= wheight+document.body.scrollTop) ydir = '--';
if (pic1.pixelLeft >= wwidth+document.body.scrollLeft) xdir = '--';
if (pic1.pixelLeft <= 5+document.body.scrollLeft) xdir = '++';
}
id1 = setTimeout('animate()', 30);
}
// End -->

</script>

</HEAD>

<!-- STEP TWO: Insert the event handlers into your BODY tag -->

<BODY OnLoad="getwindowsize()" OnResize="getwindowsize()" background="space.jpg">

<!-- STEP THREE: Copy this code into the BODY of your HTML document -->

<div id="pic1" style="position:absolute; visibility:visible; left:0px; top:0px; z-index:-1">
<img src="alien.gif" border="0">
</div>

<script language="javascript">
var pic1=eval('document.'+_all+'pic1'+_style);
</script>

<!-- Script Size: 2.62 KB -->

</body>
</html>[/HTML]
Oct 4 '07 #1
2 1323
JosAH
11,448 Expert 8TB
You posted all that code in the Java Forum section while all that code is Javascript
stuff; I'll move your thread to the correct forum for you.

kind regards,

Jos
Oct 4 '07 #2
MsNova
2
You posted all that code in the Java Forum section while all that code is Javascript
stuff; I'll move your thread to the correct forum for you.

kind regards,

Jos
Opps. Sorry. The computer is really not my friend today. :P
Oct 4 '07 #3

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

Similar topics

0
by: Henk Verhoeven | last post by:
Afternoon I am launching a 3rd party EXE application from within a service (with interact with desktop checked), the programs starts up fine, but this 3rd part application prints to a PDF...
3
by: Crimefighter | last post by:
I'm not a javascript guy, but the use of this banner rotator script has given me fits. I know a few causes of the problem thus far, one being the layer tags aren't supported under Netscape 7.1...
7
by: michael | last post by:
apologies in advance, as not only am i new to learning how to code javascript properly, i'm new to the groups posting thing... i am developing in firefox 1.0+, but will be working in an msie 6.0+...
1
by: stuart dent via .NET 247 | last post by:
XML validation error. Help required If anyone can help me, thankyou, thankyou... When I run this code code I get this error: The data at the root level is invalid. Line 1, position 39. I...
9
by: Trint Smith | last post by:
I have tried everything...aspreg -i and modifying machine.config and running the fileupdate...deleting and reinstalling framework 1.1... It only happens when I do a 'Copy Project' to the...
1
by: info | last post by:
I have a 'no properties error' (from Firefox's 1.5 javascript console) on: var position_pt = options.search(";") in the following segment of code. The strange thing is that I'm referencing the...
3
by: droesler | last post by:
I have a function that receives a form name and field name. someFunc(formName, fieldName) { var fieldVal = document.forms.elements.value; } This triggers the 'has no properties error. An...
4
by: Rocketman | last post by:
Error Help: CLI0120E Memory Allocation Failure -------------------------------------------------------------------------------- Hi Any help would really be appreciated. I am getting the...
5
by: Ty | last post by:
Syntax Error-Help!! My error "SQL0180N The syntax of the string representation of a datetime value is incorrect. SQLSTATE=22007" . I'm using yyyy-mm-dd. I can see the dates in a column on...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.