Kamala Harris - Find jobs - Debt Consolidation - Debt Consolidation - Wordpress Themes

PDA

View Full Version : java script and Firefox


login
Aug 20th 2007, 1:21 pm
Why is this not working in firefox, it works in IE and Opera.

java script:

function toggleMenu() {
var oMenu = document.getElementById("item");
if(oMenu.style.display == "none")
oMenu.style.display = "block";
else
oMenu.style.display = "none";
}


html:

<ul>
<li onclick="toggleMenu();">Menu</li>
<li id="item" style="display:none;">
<ul>
<li><a href="http://www.site1.com">site1</a></li>
<li><a href="http://www.site2.com">site2</a></li>
</ul>
</li>
</ul>

Thanks.

bogs
Aug 20th 2007, 1:24 pm
have you tried ecma script? counter part of javascript.. its works like javascript too...

login
Aug 20th 2007, 1:24 pm
I have never heard about it. Will research.

Logic Ali
Aug 20th 2007, 3:31 pm
Why is this not working in firefox, it works in IE and Opera.It does work - something else in the document must be breaking it.

login
Aug 20th 2007, 3:46 pm
Ok, thanks Ali. Will check that. Why isnt that something else breaking it in IE and Opera too?

saadalgazzar
Aug 20th 2007, 5:30 pm
beacousr firefox is like the baby behind Internet explorer

login
Aug 20th 2007, 5:40 pm
beacousr firefox is like the baby behind Internet explorer

Well, IE is the one not following the rules... all that special html fixes and so on.

mjamesb
Aug 20th 2007, 5:50 pm
It works for me too...So FF is not the issue. To anyone programming Javascript if you are not using FireBug then you are making coding so much harder on yourself than you have to. Just Google "FireBug".it is a free plugin for FF and works great. You can set break points, step through line by line..it will even show you what line the error is on. It has too many tools to mention but it has made writing JS much more effecient for me and many people I know.

p.s. FF is superior to IE especially when performing complex client side scripts. The more complicated the slower IE renders.

login
Aug 20th 2007, 7:02 pm
I tried firebug and got this error:

menusyk is not defined
onclick(click clientX=0, clientY=0)

Any idea what I should change?

Logic Ali
Aug 21st 2007, 9:02 am
I tried firebug and got this error:

menusyk is not defined
onclick(click clientX=0, clientY=0)

Any idea what I should change?Change whatever it is that is allowing a reference to be made to the non-existent object menusyk - or post more code.

login
Aug 21st 2007, 9:10 am
This is the site in question.
www.altomhelse.info

if you got the possibility, could you please take a quick look at it?

Logic Ali
Aug 21st 2007, 11:20 am
This is the site in question.
www.altomhelse.info

if you got the possibility, could you please take a quick look at it?

The code you presented is not the same as that on your site.

<p onclick="toggleMenu(menusyk);">Sykdommer</p>Should be
<p onclick="toggleMenu('menusyk');">Sykdommer</p>


function toggleMenu(menusyk) {
var oMenu = document.getElementById("menusyk");
if(oMenu.style.display == "none")
oMenu.style.display = "block";
else
oMenu.style.display = "none";
}Should be
function toggleMenu(menusyk) {
var oMenu = document.getElementById(menusyk);
if(oMenu.style.display == "none")
oMenu.style.display = "block";
else
oMenu.style.display = "none";
}

Divisive Cottonwood
Aug 21st 2007, 11:40 am
have you tried ecma script? counter part of javascript.. its works like javascript too...

ecma script and javascript are one and the same

login
Aug 21st 2007, 11:59 am
Great Logic Ali, that works, Thanks for helping. Can I offer you a free PR5 link for some time?

MMJ
Aug 22nd 2007, 6:57 am
ecma script and javascript are one and the same
lol. :p

:)