Click to See Complete Forum and Search --> : Mac Problem


Elaine S
01-08-2004, 04:09 AM
Hi all

I have a problem with an adapted menu script (orig. from Brainjar.com); can anybody help me with this?

The menu is active at www.cumbrianlakesresort.com but currently the menu opens in completely the wrong place on macs. (Something to do with pageOffset's being different?)

Anyway, I tried to add a section that recognises a mac and adjusts the position of the menu differently - but apparently this doesn't work. I don't have a mac to be able to check it myself as I adjust it. I'm a bit of a beginner at this, so I'm sure it's something easy...

Script excerpt is below (let me know if you need more) any suggestions would be gratefully received!

Thanks

Elaine S




function showmenu(e,which,menuNumber){

if (!document.all&&!document.getElementById&&!document.layers)
return

clearhidemenu()

menuobj=ie4? document.all.popmenu : ns6? document.getElementById("popmenu")
: ns4? document.popmenu : ""
menuobj.thestyle=(ie4||ns6)? menuobj.style : menuobj

if (ie4||ns6)
menuobj.innerHTML=which
else{
menuobj.document.write('<layer name=gui bgColor=#E6E6E6 width=165
onmouseover="clearhidemenu()" onmouseout="hidemenu()">'+which+'</layer>')
menuobj.document.close()
}

menuobj.contentwidth=(ie4||ns6)? menuobj.offsetWidth :
menuobj.document.gui.document.width
menuobj.contentheight=(ie4||ns6)? menuobj.offsetHeight :
menuobj.document.gui.document.height
eventX=ie4? event.clientX : ns6? e.clientX : e.x
eventY=ie4? event.clientY : ns6? e.clientY : e.y

var adj=760
var topadj=163
var radj1=181
var radj2=309
var radj3=444
var radj4=606
menuobj.thestyle.visibility="visible";
if (menuNumber==1) {

if (navigator.userAgent.indexOf("Mac")!=-1) {
menuobj.thestyle.left= ie4?((document.body.scrollWidth-adj)/2)-310:
((window.pageXOffset-adj)/2)-310;
menuobj.thestyle.top= ie4? (document.body.clientTop)-67:
window.pageYOffset-67;
} else {
menuobj.thestyle.left=ie4? (document.body.scrollWidth-adj)/2:
(window.pageXOffset-adj)/2;
menuobj.thestyle.top= ie4? (document.body.clientTop)+topadj:
window.pageYOffset+topadj;}
}

if (menuNumber==2)
menuobj.thestyle.left= ie4? ((document.body.scrollWidth-adj)/2)+radj1:
((window.pageXOffset-adj)/2)+radj1;
menuobj.thestyle.top= ie4? (document.body.clientTop)+topadj:
window.pageYOffset+topadj;
if (menuNumber==3)
menuobj.thestyle.left= ie4? ((document.body.scrollWidth-adj)/2)+radj2:
((window.pageXOffset-adj)/2)+radj2;
menuobj.thestyle.top= ie4? (document.body.clientTop)+topadj:
window.pageYOffset+topadj;
if (menuNumber==4)
menuobj.thestyle.left= ie4? ((document.body.scrollWidth-adj)/2)+radj3:
((window.pageXOffset-adj)/2)+radj3;
menuobj.thestyle.top= ie4? (document.body.clientTop)+topadj:
window.pageYOffset+topadj;
if (menuNumber==5)
menuobj.thestyle.left= ie4? ((document.body.scrollWidth-adj)/2)+radj4:
((window.pageXOffset-adj)/2)+radj4;
menuobj.thestyle.top= ie4? (document.body.clientTop)+topadj:
window.pageYOffset+topadj;
}

Khalid Ali
01-08-2004, 06:56 AM
menu even doesn't seem to work on Mozila 1.4.1.
Which means code is incorect.
If you write code for IE and then try to use it on MAC IE 99% it won't work because MAC IE is more standard compliant then IE on windows.

Elaine S
01-08-2004, 07:52 AM
thanks - no idea why it doesn't work in mozila but does in IE - can you see any glaring errors in the code I posted?

Also, the comment about compliance doesn't make sense to me - surely if mac is MORE compliant it would be scripts in mac that wouldn't work on PC not the other way round?