...

View Full Version : JavaScript - Not Working in IE



FlawedKid
05-02-2006, 10:21 PM
I working on a site re-design and I have run into some trouble when I tested the site in IE.
Please take a look at the site:
HERES THE SITE (http://www.innov8media.net/newsite/services.php)

I generaly use Mozilla and the floating Div displays fine. I will past the code but you can may also want to do a View Page Source.

I have given the Div and ID name of "FloatLayer" which is refered to in the JS. Just incase your wondering.

Ok so heres the JS code place below my Menu/DIV


<script language="JavaScript" type="text/JavaScript">
var hX = 'centre';
var vY = 291;
var nn=(navigator.appName.indexOf("Netscape")!=-1);
var dD=document,dH=dD.html,dB=dD.body,px=dD.layers?'':'px';

function floatLayer(iX,iY,id){
var L=dD.getElementById?dD.getElementById(id):dD.all?dD.all[id]:dD.layers[id];
this[id+'O']=L;
if(dD.layers)L.style=L;
L.nX=L.iX=iX;
L.nY=L.iY=iY;

L.P=function(x,y){
this.style.left=x+px;
this.style.top=y+px;
}
L.Fm=function(){
var pX, pY;
pX=(this.iX >=0)?0:nn?innerWidth:nn&&dH.clientWidth?dH.clientWidth:dB.clientWidth;
pY=nn?pageYOffset:nn&&dH.scrollTop?dH.scrollTop:dB.scrollTop;
if(this.iY<0)pY+=nn?innerHeight:nn&&dH.clientHeight?dH.clientHeight:dB.clientHeight;
this.nX+=.1*(pX+this.iX-this.nX);
this.nY+=.1*(pY+this.iY-this.nY);
this.P(this.nX,this.nY);
setTimeout(this.id+'O.Fm()',33);
}
return L;
}
floatLayer(hX,vY,'FloatLayer').Fm();
</script>


I would really appreciate some help with this ASAP! as its an urgent matter for me.

Biggest thanks in advance EVER :thumbsup:

FlawedKid
05-02-2006, 10:44 PM
I just received a PM from FCI, who offered some kind advice and that was to replace the code.


L.P=function(x,y){
this.style.left=x+px;
this.style.top=y+px;
}

With...


L.P=function(x,y){
try {
this.style.left=x+px;
this.style.top=y+px;
} catch(e) {
this.style.pixelLeft=x+'px';
this.style.pixelTop=y+'px';
}
}

But unfortunately this did not help :( what this did was position the DIV/Menu in the top left hand corner and was still un-scrollable/floating when viewing in IE. But again showd fine in Mozilla?

Just thort the above ^^ would be worth mentioning and maybe lead someone in the direction to solving my problem. :confused:

_Aerospace_Eng_
05-03-2006, 12:15 AM
Hmm I don't know dom well enough to understand your code but I see that hX is spelt centre. CSS uses the American spellings center (I'm American BTW). Perhaps the spelling of center has something to with it? This menu may or may not give you some inspiration. http://www.dynamicdrive.com/dynamicindex1/staticmenu3.htm
You can probably even do this whole thing with out javascript well for Firefox anyways.

FlawedKid
05-03-2006, 12:57 AM
Thank for the post, :thumbsup:

I am Australian hence the spelling 'centre'. I made the changes using the american lingo but it made not difference :mad: GOD DAM IE why can't everyone just use MOZ!

Any other suggestions are more than welcome ;)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum