Click to See Complete Forum and Search --> : Scripts works in NS4,IE4 but not in NS7


Jlamb1
09-12-2003, 02:44 AM
Hi,
The mouseover & scroll effect works fine in NS4 but dun know why it doesnt works in NS7. Hope someone can take alook and help to amend my codes below.. Appreciated !
**********************************
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
function init() {
for (var temp = 0; temp < scrolllayers.length; temp++) {
if (ns4) {
initnslayers(scrolllayers[temp]);
}
if (ie4) {
initielayers(scrolllayers[temp]);
}
initgenlayers(scrolllayers[temp]);
}
function show(id) {
if (ns4) {
document.layers[id].visibility = "show"
} else if (ie4)
{
document.all[id].style.visibility = "visible"
}
else if (ns7) {
document.layers[id].visibility = "show"

}else

{
document.getElementById[id].visibility = "show"

document.layers[id].visibility = "show"
document.all[id].style.visibility = "visible"
}
}
function hide(id) {
if (ns4) {
document.layers[id].visibility = "hide"
}
else if (ie4) {
document.all[id].style.visibility = "hidden"
}
else {

document.layers[id].visibility = "hide"
document.all[id].style.visibility = "hidden"
}
}
<body bgcolor="FFFFFF" text=#000000 link=#333333 vlink=#333333 alink=#333333 onLoad="javascript: init();>
<div id=companymenu onmouseout="hide('companymenu')"
onmouseover="show('companymenu');">

Fang
09-12-2003, 05:25 AM
NS7 does not support layers use document.getElementById()

Not document.getElementById[id].visibility
but document.getElementById(id).style.visibility

Jlamb1
09-15-2003, 09:22 PM
Hi,
I am very new in this.. I changed the code but dont seems to be working., dunknow where go wrong.. can someone take alook and help me ! thanks !!

ns4 = (document.layers)? true:false
ns7 = (document.getElementById()) ? true:false
ie4 = (document.all)? true:false

function show(id) {
if (ns4) {
document.layers[id].visibility = "show"
} else if (ie4)
{
document.all[id].style.visibility = "visible"
}else{
document.getElementById(id).style.visibility = "show"
}
}
function hide(id) {
if (ns4) {
document.layers[id].visibility = "hide"
}
else if (ie4) {
document.all[id].style.visibility = "hidden"
} else{
document.getElementById(id).style.visibility = "hidden"
}
}

Fang
09-16-2003, 01:50 AM
It does work, but change this line:
ns7 = (document.getElementById) ? true:false
What error/problem is occurring?

Jlamb1
09-16-2003, 02:34 AM
Hi Fang,
The problem is when I mouseover , it is not showing anything.Probably the following sets of codes are the cause of the problem, it does not triggle the event in NS7, it works fine in NS4 & IE... some missing codes ? (i guess).Please assist

<div id=testmenu onmouseout="hide('testmenu')"
onmouseover="show('testmenu');"><layer
onmouseout="hide('testmenu');" onmouseover="show('testmenu');">

Fang
09-16-2003, 03:01 AM
Once the element is hidden, any subsequent event for that element will not work.

Jlamb1
09-16-2003, 03:30 AM
It is calling the function hide().... & function show () (see the earlier 1st attached codes)

function hide(id) {
if (ns4) {
document.layers[id].visibility = "hide"
}
else if (ie4) {
document.all[id].style.visibility = "hidden"
} else{
document.getElementById(id).style.visibility = "hidden"
}
}

It is supposed to display some text when I do a onmouseover , in NS4 & IE4, there are no problem at all

you mean the onmouseover / onmouseout will not work in NS7 ??

Fang
09-16-2003, 05:48 AM
document.getElementById(id).style.visibility = "visible"