/    Sign up×
Community /Pin to ProfileBookmark

A little debugging help pls

Hi there,

With IE – i seem to get an error about an invalid arguement.

could anybody please help.
Here is my code.

[I]
<SCRIPT LANGUAGE=”javascript1.2″>

<!– Begin
var brOK = false, mie = false;
if (document.layers || document.all) brOK = true;
if (document.all) mie = true;
var ex = 0, ey = 0;
var x0, y0, tid, realx, realy;
var myX = 0;
var ae, le, re;

function navMove(e) {
ex = e.pageX;
ey = e.pageY;
moveeye()
return routeEvent(e);
}

function mieMove() {
//alert(‘here’);
myX++;
if (myX % 2 != 0)
{
ex = self.innerWidth – 20;
ey = self.innerHeight;
}
else
{
ex = 20;
ey = self.innerHeight;
}
moveeye();
setTimeout(‘mieMove()’, 5000);
}
function moveeye() {
dy = ey – y0 – 20;
dx1 = ex – x0 – 20;
dx2 = ex – x0 – 60;
r = Math.sqrt(dx1 * dx1 + dy * dy);
if (r < 20) r = 20;
dx1 = dx1 * 10 / r + x0 + 10;
dy1 = dy *
10 / r + y0 + 10;
r = Math.sqrt(dx2 * dx2 + dy * dy);
if (r < 20) r = 20;
dx2 = dx2 * 10 / r + x0 + 50;
ae.left = x0;
ae.top = y0;
le.left = dx1;
le.top = dy1;
re.left = dx2;
re.top = dy1;
}
function setHandlers() {
var myX = 0;
if (!mie) {
y0 = document.eyeballs.top;
x0 = document.eyeballs.left;
ae = document.eyeballs;
le = document.lefteye;

re = document.righteye;

//window.captureEvents(Event.MOUSEMOVE);
//window.onMouseMove = navMove;
navMove();
}
else {
y0 = document.all.eyeballs.style.pixelTop;
x0 = document.all.eyeballs.style.pixelLeft;
ae = document.all.eyeballs.style;
le = document.all.lefteye.style;
re = document.all.righteye.style;
//window.document.onmousemove = mieMove;

mieMove();
}
realx = x0 + 0.1;
realy = y0 + 0.1;
moveall();
}
function moveall() {
rx = realx + 40;
ry = realy + 40;
rx += (ex – rx) * 0.1;
ry += (ey – ry) *
0.1;
realx = rx – 40;
realy = ry – 40;
x0 = Math.round(realx);
y0 = Math.round(realy);
moveeye();
tid = setTimeout(‘moveall()’, 100);
}
function placeeyes(x, y) {
if (brOK) {
ex = x + 40;
ey = y + 40;
s = ‘<DIV ID =”dummy” STYLE=”position:absolute; ‘ +
‘top:’+y+’; left:’+x+’; width:10; height:10;”> </DIV>’;
s += ‘<DIV ID=”eyeballs” STYLE=”position:absolute; ‘ +
‘top:’+y+’; left:’+x+’; width:80; height:40;”><IMG SRC=’ +
‘”whites.gif” border=0></DIV>’;
s += ‘<DIV ID=”lefteye” STYLE=”position:absolute; ‘ +
‘top:’+(y+10)+’; left:’+(x+10)+’; width:20; height:20;”>’ +
‘<IMG SRC=”pupil.gif” border=0></DIV>’;
s += ‘<DIV ID=”righteye” STYLE=”position:absolute; ‘ +
‘top:’+(y+10)+’; left:’+(x+50)+’; width:20; height:20;”>’ +
‘<IMG SRC=”pupil.gif” border=0></DIV>’;
document.writeln(s);
}
}
function clearEyes() {
if (tid)
{
clearTimeout(tid);
}
}
placeeyes(0,150);
window.onload = setHandlers;
window.onunload = clearEyes;
//if (mie) {mieMove();}

// End –>
</script>[/I]

Thanks in advance

mdw…

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@David_HarrisonJun 30.2004 — Surely this script must work with some HTML. Is there more code?

I tried the code just by itself and was informed by Mozilla Firefox that, "document.eyeballs has no properties on line 75."

Here is line 75 by the way:y0 = document.eyeballs.top;
Copy linkTweet thisAlerts:
@SniperXauthorJul 01.2004 — [I]

<html>

<head>

<SCRIPT LANGUAGE="javascript1.2">



<!-- Begin

var brOK = false, mie = false;

if (document.layers || document.all) brOK = true;

if (document.all) mie = true;

var ex = 0, ey = 0;

var x0, y0, tid, realx, realy;

var myX = 0;

var ae, le, re;



function navMove(e) {

ex = e.pageX;

ey = e.pageY;

moveeye()

return routeEvent(e);

}



function mieMove() {

//alert('here');

myX++;

if (myX % 2 != 0)

{

ex = self.innerWidth - 20;

ey = self.innerHeight;

}

else

{

ex = 20;

ey = self.innerHeight;

}

moveeye();

setTimeout('mieMove()', 5000);

}

function moveeye() {

dy = ey - y0 - 20;

dx1 = ex - x0 - 20;

dx2 = ex - x0 - 60;

r = Math.sqrt(dx1 * dx1 + dy * dy);

if (r < 20) r = 20;

dx1 = dx1 * 10 / r + x0 + 10;

dy1 = dy *
10 / r + y0 + 10;

r = Math.sqrt(dx2 * dx2 + dy * dy);

if (r < 20) r = 20;

dx2 = dx2 * 10 / r + x0 + 50;

ae.left = x0;

ae.top = y0;

le.left = dx1;

le.top = dy1;

re.left = dx2;

re.top = dy1;

}

function setHandlers() {

var myX = 0;

if (!mie) {

y0 = document.eyeballs.top;

x0 = document.eyeballs.left;

ae = document.eyeballs;

le = document.lefteye;


re = document.righteye;


//window.captureEvents(Event.MOUSEMOVE);

//window.onMouseMove = navMove;

navMove();

}

else {

y0 = document.all.eyeballs.style.pixelTop;

x0 = document.all.eyeballs.style.pixelLeft;

ae = document.all.eyeballs.style;

le = document.all.lefteye.style;

re = document.all.righteye.style;

//window.document.onmousemove = mieMove;



mieMove();

}

realx = x0 + 0.1;

realy = y0 + 0.1;

moveall();

}

function moveall() {

rx = realx + 40;

ry = realy + 40;

rx += (ex - rx) * 0.1;

ry += (ey - ry) *
0.1;

realx = rx - 40;

realy = ry - 40;

x0 = Math.round(realx);

y0 = Math.round(realy);

moveeye();

tid = setTimeout('moveall()', 100);

}

function placeeyes(x, y) {

if (brOK) {

ex = x + 40;

ey = y + 40;

s = '<DIV ID ="dummy" STYLE="position:absolute; ' +

'top:'+y+'; left:'+x+'; width:10; height:10;"> </DIV>';

s += '<DIV ID="eyeballs" STYLE="position:absolute; ' +

'top:'+y+'; left:'+x+'; width:80; height:40;"><IMG SRC=' +

'"whites.gif" border=0></DIV>';

s += '<DIV ID="lefteye" STYLE="position:absolute; ' +

'top:'+(y+10)+'; left:'+(x+10)+'; width:20; height:20;">' +

'<IMG SRC="pupil.gif" border=0></DIV>';

s += '<DIV ID="righteye" STYLE="position:absolute; ' +

'top:'+(y+10)+'; left:'+(x+50)+'; width:20; height:20;">' +

'<IMG SRC="pupil.gif" border=0></DIV>';

document.writeln(s);

}

}

function clearEyes() {

if (tid)

{

clearTimeout(tid);

}

}

placeeyes(0,150);

window.onload = setHandlers;

window.onunload = clearEyes;

//if (mie) {mieMove();}



// End -->

</script>

</head>

<BODY bgcolor='black'>

<h1 style='color:gold;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Bling Bling</h1>

</body>

</html>

[/I]
Copy linkTweet thisAlerts:
@David_HarrisonJul 01.2004 — Are there any images to go with this, and anything else there might be?
Copy linkTweet thisAlerts:
@TheBearMayJul 01.2004 — Change:
[code=php]
if (myX % 2 != 0)
{
ex = self.innerWidth - 20;
ey = self.innerHeight;
}
else
{
ex = 20;
ey = self.innerHeight;
}
[/code]

to:
[code=php]
if (myX % 2 != 0)
{
//ex = self.innerWidth - 20;
//ey = self.innerHeight;
ey=screen.availHeight;
ex=screen.availWidth - 20;
}
else
{
ex = 20;
//ey = self.innerHeight;
ey=screen.availHeight;
}
[/code]
Copy linkTweet thisAlerts:
@hongguoJul 07.2004 — www.titosoftware.com...for your debugging and profiling needs.
×

Success!

Help @SniperX spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...