Need help with Java (Image floating)

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Watch

abcde

Established Member
Impact
16
I have this java code helps to floating images on the right and left of a web site. It works fine with IE, but on FF... it does not work.

here it is:
Code:
//////////////////////////////////////////////////////////////////
///              BEGIN
//////////////////////////////////////////////////////////////////

// set the width of the ad banner
var bannerleft_w = 0;
var bannerrite_w = 0;

var FloatBanner = new Array();

if (typeof(PageHost) == 'undefined')
{
	var PageHost = '';
}

FloatBanner[0]= new Array('http://mydomain.com/spacer.gif','#','1');
FloatBanner[1]= new Array('http://mydomain.com/image.gif','http://www.anotherdomain.com','2');


	window.onresize=ShowAdDiv;
	
	function FloatTopDiv()
	{
/////////////////////////////////////////////////////////////
///              Initial X and Y position of the banners !
/////////////////////////////////////////////////////////////
		startLX = ((document.body.clientWidth -780)/2) - 110 , startLY = 0;
		startRX = ((document.body.clientWidth)/2) + 398 , startRY = 0;

		var d = document;
		function ml(id)
		{
			var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
			el.sP=function(x,y){this.style.left=x;this.style.top=y;};
			el.x = startRX;
			el.y = startRY;
			return el;
		}
		function m2(id)
		{
			var e2=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
			e2.sP=function(x,y){this.style.left=x;this.style.top=y;};
			e2.x = startLX;
			e2.y = startLY;
			return e2;
		}
		window.stayTopLeft=function()
		{
			if (document.documentElement && document.documentElement.scrollTop)
				var pY =  document.documentElement.scrollTop;
			else if (document.body)
				var pY =  document.body.scrollTop;
			if (document.body.scrollTop > 30){startLY = 3;startRY = 3;} else {startLY = 0;startRY = 0;};
			ftlObj.y += (pY+startRY-ftlObj.y)/16;
			ftlObj.sP(ftlObj.x, ftlObj.y);
			ftlObj2.y += (pY+startLY-ftlObj2.y)/16;
			ftlObj2.sP(ftlObj2.x, ftlObj2.y);
			setTimeout("stayTopLeft()", 1);
		}
		ftlObj = ml("divAdRight");
		ftlObj2 = m2("divAdLeft");
		stayTopLeft();
	}
	
	function ShowAdDiv()
	{
		var objAdDivRight = document.getElementById("divAdRight");
		var objAdDivLeft = document.getElementById("divAdLeft");		
		
		if (document.body.clientWidth < 980)
		{
		    objAdDivRight.style.display = "none";
			objAdDivLeft.style.display = "none";
		}
		else
		{
			objAdDivRight.style.display = "block";
			objAdDivLeft.style.display = "block";
			FloatTopDiv();
		}
	}
	

function DisplayFloatBanner(side)
{
	document.write('<table cellspacing=0 cellpadding=0 border=0 width='+bannerleft_w+' >')
	
	if (side==1) // on left
		for (i=0; i<FloatBanner.length; i++){
			if(FloatBanner[i][2]=='1'){						
				document.write('<tr><td><a target="_blank" href="'+FloatBanner[i][1]+'"><img src="'+FloatBanner[i][0]+'" width='+bannerleft_w+' border=0></a>');
				document.write('<tr><td><object width="100" height="200"><param name="movie" value="http://www.mydomain.com/ads/yan_25-2.swf"><param name="quality" value="high"><embed src="http://www.mydomain.com/ads/yan_25-2.swf" quality="high" width="100" height="200"></embed></object></br></td></tr>');
			}
		}
				
					
	if (side==2) // on right
		for (i=0; i<FloatBanner.length; i++){
			if(FloatBanner[i][2]=='2'){
				document.write('<tr><td><a target="_blank" href="'+FloatBanner[i][1]+'"><img src="'+FloatBanner[i][0]+'" width="100" height="200" border=0></a><br></td></tr>');
				//document.write('<tr><td><object width="100" height="200"><param name="movie" value="http://data.mydomain.com/data/adv/fullsize/liveshow_tramy2_247.swf"><param name="quality" value="high"><embed src="http://data.mydoamin.com/data/adv/fullsize/liveshow_tramy2_247.swf" quality="high" width="100" height="200"></embed></object>'); 
			}
		}

	document.write('</table>');
}

//////////////////////////////////////////////////////////////////
///              END
//////////////////////////////////////////////////////////////////


Code:
<DIV id=divAdRight style="DISPLAY: none; POSITION: absolute; TOP: 0px"> <script language="JavaScript">DisplayFloatBanner(2);</script> </DIV>
<DIV id=divAdLeft style="DISPLAY: none; POSITION: absolute; TOP: 0px"> <script language="JavaScript">DisplayFloatBanner(1);</script> </DIV>
<SCRIPT language=JavaScript>ShowAdDiv();</SCRIPT>


Thanks
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Hi, I hope I don't offend you by these words, but this is not Java. This is JavaScript.
Java doesn't have "var" type definition, and isn't used like this.

I hope someone can help you because I am not good at Javascript.
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back