Closed Thread Icon

Topic awaiting preservation: Can any one help with cross-browser problem? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=9063" title="Pages that link to Topic awaiting preservation: Can any one help with cross-browser problem? (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Can any one help with cross-browser problem? <span class="small">(Page 1 of 1)</span>\

 
Aquilo
Bipolar (III) Inmate

From: las vegas, nevada, us
Insane since: Nov 2000

posted posted 04-06-2004 00:22

I have been trying fo two days to get this script to work in firefox, looking at other simmiler scripts that work in firefox but still can't find the answer to why it's not working, I think I've add 50% more code them what I started with and still nothing.

Can anyone point me in the direction to where the problem is in this script?

code:
<script language="JavaScript" type="text/javascript">
var ns6=document.getElementById&&!document.all;
var vmin=5;
var vmax=5;
var vr=2;
var timer1;

function Chip (chipname, width, height)
{
this.named = chipname;
this.vx = vmin+vmax*Math.random();
this.vy = vmin+vmax*Math.random();
this.w = width;
this.h = height;
this.xx = 0;
this.yy = 0;
this.timer1 = null;
}

function movechip (chipname)
{
eval( 'chip=' + chipname);
if(!getRefToDivNest(chipname)) { return; }

var scrWidth = 0, scrHeight = 0, scrollHeight = 0, scrollWidth = 0;
//find screen settings for all variations. doing this every time allows for resizing and scrolling
if(typeof(window.innerWidth) == 'number')
{
scrWidth = window.innerWidth-10;
scrHeight = window.innerHeight-10;
}
else
{
if(document.documentElement && (document.documentElement.clientWidth &#0124; &#0124; document.documentElement.clientHeight))
{
scrWidth = document.documentElement.clientWidth-10;
scrHeight = document.documentElement.clientHeight-10;
}
else
{
if(document.body && (document.body.clientWidth &#0124; &#0124; document.body.clientHeight))
{
scrWidth = document.body.clientWidth-10;
scrHeight = document.body.clientHeight-10;
}
}
}

if(typeof(window.pageYOffset) == 'number')
{
scrollHeight = pageYOffset;
scrollWidth = pageXOffset;
}
else
{
if(document.body && (document.body.scrollLeft &#0124; &#0124; document.body.scrollTop))
{
scrollHeight = document.body.scrollTop;
scrollWidth = document.body.scrollLeft;
}
else
{
if(document.documentElement && (document.documentElement.scrollLeft &#0124; &#0124; document.documentElement.scrollTop))
{
scrollHeight = document.documentElement.scrollTop;
scrollWidth = document.documentElement.scrollLeft;
}
}
}

chip.xx = chip.xx+chip.vx;
chip.yy = chip.yy+chip.vy;

chip.vx += vr*(Math.random()-0.5);
chip.vy += vr*(Math.random()-0.5);

if (chip.vx > (vmax+vmin)) chip.vx = (vmax+vmin)*2-chip.vx;
if (chip.vx < (-vmax-vmin)) chip.vx = (-vmax-vmin)*2-chip.vx;
if (chip.vy > (vmax+vmin)) chip.vy = (vmax+vmin)*2-chip.vy;
if (chip.vy < (-vmax-vmin)) chip.vy = (-vmax-vmin)*2-chip.vy;

if (chip.xx <= scrollWidth)
{
chip.xx =scrollWidth;
chip.vx =vmin+vmax*Math.random();
}

if (chip.xx >= scrollWidth+scrWidth-chip.w)
{
chip.xx =scrollWidth+scrWidth-chip.w;
chip.vx =-vmin-vmax*Math.random();
}

if (chip.yy <= scrollHeight)
{
chip.yy =scrollHeight;
chip.vy =vmin+vmax*Math.random();
}

if (chip.yy >= scrollHeight+scrHeight-chip.h)
{
chip.yy =scrollHeight+scrHeight-chip.h;
chip.vy =-vmin-vmax*Math.random();
}


if (document.layers)
{
eval( 'document.chip1.top =' + chip.yy);
eval( 'document.chip1.left=' + chip.xx);
}
else if (document.all)
{
eval( 'document.all.chip1.style.pixelLeft=' + chip.xx);
eval( 'document.all.chip1.style.pixelTop =' + chip.yy);
}
else if (ns6)
{
eval( 'document.getElementById(chip1).style.left=' + chip.xx);
eval( 'document.getElementById(chip1).style.top =' + chip.yy);
}

chip.timer1 = setTimeout("movechip('" + chip.named + "')", 25);
}


function stopme (chipname)
{
eval( 'chip=' + chipname);
if (chip.timer1!=null)
{
clearTimeout(chip.timer1)
}
}

//DHTML handlers
function getRefToDivNest(divName) {
if( document.layers ) { return document.layers[divName]; } //NS4
if( document[divName] ) { return document[divName]; } //NS4 also
if( document.getElementById ) { return document.getElementById(divName); } //DOM (IE5+, NS6+, Mozilla0.9+, Opera)
if( document.all ) { return document.all[divName]; } //Proprietary DOM - IE4
return false;
}
</script>

<script language="JavaScript" type="text/javascript">
/*
Floating image script
By Virtual_Max (http://www.geocities.com/siliconvalley/lakes/8620)
Permission granted to Dynamicdrive.com to feature it in it's archive
For 100's of FREE DHTML scripts and components,
Visit [url=http://dynamicdrive.com]http://dynamicdrive.com[/url]
*/

var chip1;
//add or delete more variables, depending on how many images you're using

function pagestart()
{
chip1=new Chip("chip1",60,80);
chip1.xx = 234;
chip1.yy = 423;

//add or delete more of the above, depending on how many images you're using
if(document.layers&#0124; &#0124;document.all&#0124; &#0124;(document.getElementById && !document.all))
{
movechip("chip1");
//add or delete more of the above, depending on how many images you're using
}
}
</script>
<script language="JavaScript" type="text/javascript">
var html ='';
var llama = '<a href="index.php?action=magicLlama;magicLlama=MD5_STRING">';
llama += '<img name="Llama" src="./golden_llama2.gif" border=0></a>';
if (document.layers)
{
html += '<layer id="chip1" name="chip1" style="position: absolute; top: 423; left: 234; width: 68; height: 68; z-index: 5">';
html += llama;
html += '</layer>';
document.write(html);
}
else
{
html += '<div id="chip1" name="chip1" style="position: absolute; top: 423; left: 234; width: 68; height: 68; z-index: 5">';
html += llama;
html += '</div>';
document.write(html);
}
pagestart();
window.onUnload = "stopme('chip1');";
</script>



Thanks a million for any help, tips!
Aquilo

<A HREF="http://x-design.atari.org
" TARGET=_blank> <img border=0 src="http://xtram.hypermart.net/downloads/aquilo_ozone.gif[/IMG]</A>
[img]">

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 04-06-2004 00:50

Without trying it ( does anyone else have cut & paste problems with "code:" in the tags not getting line breaks and a solution?)

Have you tried the Javascript Debugger in Firefox? Tools>>Javascript Console



.:[ Never resist a perfect moment ]:.

Aquilo
Bipolar (III) Inmate

From: las vegas, nevada, us
Insane since: Nov 2000

posted posted 04-06-2004 00:59

I didn't know it had that I'll try that real quick! Thanks!

<A HREF="http://x-design.atari.org
" TARGET=_blank> <img border=0 src="http://xtram.hypermart.net/downloads/aquilo_ozone.gif[/IMG]</A>
[img]">

Aquilo
Bipolar (III) Inmate

From: las vegas, nevada, us
Insane since: Nov 2000

posted posted 04-06-2004 01:12

I was geting an error that this line

code:
eval( 'document.getElementById(chip1).style.left=' + chip.xx);



had no properties so I changed it and the next line to this

code:
eval( 'document.getElementById("chip1").style.left=' + chip.xx);



with the quotes and the error is gone, but it still don't work it will go from the bottm of the page to the top if I click a menu item in the tool bar.

<A HREF="http://x-design.atari.org
" TARGET=_blank> <img border=0 src="http://xtram.hypermart.net/downloads/aquilo_ozone.gif[/IMG]</A>
[img]">

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 04-06-2004 02:01

Why are you using the eval tags?

Why not just

document.getElementById("chip1").style.left = chip.xx;



.:[ Never resist a perfect moment ]:.

Aquilo
Bipolar (III) Inmate

From: las vegas, nevada, us
Insane since: Nov 2000

posted posted 04-06-2004 02:06

that is the way the script was, I'll try removing them if you think it may work better!

<A HREF="http://x-design.atari.org
" TARGET=_blank> <img border=0 src="http://xtram.hypermart.net/downloads/aquilo_ozone.gif[/IMG]</A>
[img]">

Aquilo
Bipolar (III) Inmate

From: las vegas, nevada, us
Insane since: Nov 2000

posted posted 04-06-2004 02:14

I removed the eval statments and it still works in IE but still nothing in FireFox.

<A HREF="http://x-design.atari.org
" TARGET=_blank> <img border=0 src="http://xtram.hypermart.net/downloads/aquilo_ozone.gif[/IMG]</A>
[img]">

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 04-06-2004 09:29

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Aquilo
Bipolar (III) Inmate

From: las vegas, nevada, us
Insane since: Nov 2000

posted posted 04-06-2004 14:35

Thank you! That did it!

<A HREF="http://x-design.atari.org
" TARGET=_blank> <img border=0 src="http://xtram.hypermart.net/downloads/aquilo_ozone.gif[/IMG]</A>
[img]">

smonkey
Paranoid (IV) Inmate

From: Northumberland, England
Insane since: Apr 2003

posted posted 04-06-2004 16:07

Bitty,

Basically the cut a paste problem seems to appear when using IE or Notepad - if you use moz and a better text editor the line breaks usually should appear.

<A HREF="http://www.cryokinesis.co.uk" TARGET=_blank>visit

« BackwardsOnwards »

Show Forum Drop Down Menu