473,386 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

More Netscape 7 problems


Trying to make a dropdown menu. I working nice in IE6 but when I try a link
in Netscape 7 nothing happens.
Can anybody help me?

<html>
<head>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>JS</title>
</head>
<body>

<script language="JavaScript" type="text/JavaScript">

var px="px";

function getStyle(elemName) {
var elem;
if (document.getElementById) { elem=document.getElementById(elemName);}
else if (document.all) { elem=document.all[elemName];}
else if (document.layers) { elem=document.layers[elemName]; px="";}
else {return null;}

if (!elem.style) {
return elem;
}
return elem.style;
}

function hideElement(elemName) {
var style=getStyle(elemName);
if (style) {
style.visibility="hidden";
style.width=1+px;
style.height=1+px;
}
}

function showElement(elemName) {
var style=getStyle(elemName);
if (style) {
style.visibility="visible";
style.width=150+px;
style.height=80+px;
}
}

</script>

<br><br>

<a href="javascript:hideElement('test')">
<div style="position:absolute; z-index:1; left: 25px; top: 10px;"
border="0" onMouseOver="showElement('test')"
onMouseOut="hideElement('test')">
<strong>Meny<strong>
</div>
</a>

<div id="test" style="position:absolute; z-index:1; left: 25px; top: 31px;
width: 0px; height: 0px; background-color: white; overflow: hidden"
onClick="hideElement('test')" onMouseOver="showElement('test')"
onMouseOut="hideElement('test')">
<a href="mailto:te***@testing.net">te***@testing.net</a><br>
<a href="http://groups.google.com">Google groups</a><br>
<a href="http://www.yahoo.com">Yahoo</a>
</div>

</body>
</html>

--

___________________________
Best Regards,
in*****@stadmek.no

Jul 20 '05 #1
6 3069
"Ingmund Sjåstad" <in*****@sjaastad.no> wrote in message
news:r1*******************@news4.e.nsc.no...
Trying to make a dropdown menu. I working nice in
IE6 but when I try a link in Netscape 7 nothing happens.
Can anybody help me?
For me that test page works exactly the same in Netscape 7.00, 7.02 and
Mozilla 1.3 as it does in IE 6.
<html> <snip> <a href="javascript:hideElement('test')">

<snip>

Weren't you told not to use the javascritp pseudo protocol to execute
JavaScript functions as a side effect?

< URL: http://jibbering.com/faq/#4_24 >

Richard.
Jul 20 '05 #2
"Ingmund Sjåstad" wrote:
Trying to make a dropdown menu. I working nice in IE6 but when I try a link
in Netscape 7 nothing happens.
Can anybody help me?

<html>
<head>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>JS</title>
</head>
<body>

<script language="JavaScript" type="text/JavaScript">

var px="px";

function getStyle(elemName) {
var elem;
if (document.getElementById) { elem=document.getElementById(elemName);}
else if (document.all) { elem=document.all[elemName];}
else if (document.layers) { elem=document.layers[elemName]; px="";}
else {return null;}

if (!elem.style) {
return elem;
}
return elem.style;
}

function hideElement(elemName) {
var style=getStyle(elemName);
if (style) {
style.visibility="hidden";
style.width=1+px;
style.height=1+px;
}
}

function showElement(elemName) {
var style=getStyle(elemName);
if (style) {
style.visibility="visible";
style.width=150+px;
style.height=80+px;
}
}

</script>

<br><br>

<a href="javascript:hideElement('test')">
<div style="position:absolute; z-index:1; left: 25px; top: 10px;"
border="0" onMouseOver="showElement('test')"
onMouseOut="hideElement('test')">
<strong>Meny<strong>
</div>
</a>

<div id="test" style="position:absolute; z-index:1; left: 25px; top: 31px;
width: 0px; height: 0px; background-color: white; overflow: hidden"
onClick="hideElement('test')" onMouseOver="showElement('test')"
onMouseOut="hideElement('test')">
<a href="mailto:te***@testing.net">te***@testing.net</a><br>
<a href="http://groups.google.com">Google groups</a><br>
<a href="http://www.yahoo.com">Yahoo</a>
</div>

</body>
</html>

--

___________________________
Best Regards,
in*****@stadmek.no


Netscape 7 supports neither document.all (proprietary to IE and a couple other
browsers) nor document.layers (proprietary to Netscape 4.x).

You should be using document.getElementById() to access DOM items.

See <url: http://www.mozilla.org/docs/web-deve...upgrade_2.html /> for tips
on converting document.all/document.layer constructs to the new method(s).

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #3
DU
Ingmund Sjåstad wrote:
Trying to make a dropdown menu. I working nice in IE6 but when I try a link
in Netscape 7 nothing happens.
Can anybody help me?

<html>
<head>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
The doctype declaration should be the very first statement of your
webpage. I also strongly recommend that you use 4.01 and a strict DTD here.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">

<title>Title goes here</title>
<title>JS</title>
</head>
<body>

<script language="JavaScript" type="text/JavaScript">
language is a deprecated attribute. Type has replaced lagnuage and is
both backward and forward-compatible, so you can not be wrong with

<script language="JavaScript" type="text/JavaScript">

var px="px";

function getStyle(elemName) {
var elem;
if (document.getElementById) { elem=document.getElementById(elemName);}
else if (document.all) { elem=document.all[elemName];}
else if (document.layers) { elem=document.layers[elemName]; px="";}
else {return null;}

if (!elem.style) {
return elem;
}
return elem.style;
}

function hideElement(elemName) {
var style=getStyle(elemName);
if (style) {
style.visibility="hidden";
style.width=1+px;
style.height=1+px;
Why do you change the width and height when hiding or making visible an
element?
}
}

function showElement(elemName) {
var style=getStyle(elemName);
if (style) {
style.visibility="visible";
style.width=150+px;
style.height=80+px;
}
}

The above code is not complete or it's not logical. You are willing to
detect and support NS 4 (which is more than 6 years old) which uses
document.layers but you are not willing to use its "hide" and "show" for
the visibility of its DOM nodes.
</script>

<br><br>

<a href="javascript:hideElement('test')">
Do not use the "javascript:" pseudo-protocol in href attributes for many
reasons: it's bad, wrong, not recommendable,etc..

"javascript:" pseudo-protocol destroys right-click context menu.
Top Ten Web-Design Mistakes of 2002
6. JavaScript in Links:
(...) A link should be a simple hypertext reference that replaces the
current page with new content. (...) link is not a piece of code that
interferes with the browser’s standard behavior."
http://www.useit.com/alertbox/20021223.html

"Don't use javascript: URLs
Using a straight http: URL will allow any browser to access the link. If
you want to use JavaScript for browsers that have JavaScript enabled,
use the onMouseOver and onClick attributes of the <a href> tag."
http://www.rahul.net/aahz/javascript.html#remove

<div style="position:absolute; z-index:1; left: 25px; top: 10px;"
border="0" onMouseOver="showElement('test')"
onMouseOut="hideElement('test')">
<strong>Meny<strong>
</div>
</a>

<div id="test" style="position:absolute; z-index:1; left: 25px; top: 31px;
width: 0px; height: 0px; background-color: white; overflow: hidden"
onClick="hideElement('test')" onMouseOver="showElement('test')"
onMouseOut="hideElement('test')">
<a href="mailto:te***@testing.net">te***@testing.net</a><br>
<a href="http://groups.google.com">Google groups</a><br>
<a href="http://www.yahoo.com">Yahoo</a>
</div>

</body>
</html>

--

___________________________
Best Regards,
in*****@stadmek.no



DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/

Jul 20 '05 #4
DU wrote:
<snip>
... You are willing to
detect and support NS 4 (which is more than 6 years old) which uses
document.layers but you are not willing to use its "hide" and "show" for
the visibility of its DOM nodes.


The last time I checked, "visible" and "hidden" values for visibility
worked in all NN4 browsers available for testing. AFAIK these included
4.72, 4.08, 4.06 and 4.01. Results lead me to believe that the
requirement for "hide" and "show" are urban myths originated by Netscape
in a document entitled
DYNAMIC HTML IN NETSCAPE COMMUNICATOR
COMMUNICATOR PRE-RELEASE 5
and perpetuated by script writers for Dreamweaver. Of course it is
possible the documentation was correct for NS4PR5, but who in the world
cares?

Cheers,
Dom
Jul 20 '05 #5
Dom Leonard wrote:
DU wrote:
<snip>
... You are willing to
detect and support NS 4 (which is more than 6 years old) which uses
document.layers but you are not willing to use its "hide" and "show" for
the visibility of its DOM nodes.


The last time I checked, "visible" and "hidden" values for visibility
worked in all NN4 browsers available for testing. AFAIK these included
4.72, 4.08, 4.06 and 4.01. Results lead me to believe that the
requirement for "hide" and "show" are urban myths originated by Netscape
in a document entitled
DYNAMIC HTML IN NETSCAPE COMMUNICATOR
COMMUNICATOR PRE-RELEASE 5
and perpetuated by script writers for Dreamweaver. Of course it is
possible the documentation was correct for NS4PR5, but who in the world
cares?

Cheers,
Dom


"visible" and "hidden" work when setting layer visibility in Netscape 4.x.

When getting these values for testing purposes, Netscape 4.x returns "show" or
"hide".

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #6
Grant Wagner wrote:
<snip>

"visible" and "hidden" work when setting layer visibility in Netscape 4.x.

When getting these values for testing purposes, Netscape 4.x returns "show" or
"hide".


thanks Grant,

I most certainly did not know the second piece of information.

Dom
Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Peter Bremer | last post by:
Hi all, I've written this little piece of code, which doesn't seem to work in Mozilla 1.5. I haven't tried it on other Gecko browsers, but I've found some indication that Netscape 6+ has the...
7
by: Scott | last post by:
Hello All, I've been reading all of the various issues with Iframes in netscape. I have tried all of the various fixes posted, and have even implemented both an iframe and ilayer. My problem is...
2
by: Geniium | last post by:
Hello, Im looking to make work my script on both IE and Netscape. It works fine in IE, but netscape cant handle "dynamic" variables. I need some help! Is there a CORRECT way to pass a string...
3
by: Laiverd.COM | last post by:
Hi everybody, Since today the pages at http://www.laiverd.com/groundzero/anima have problems with the hover-styles in Netscape 7.1 (no problems in Mozilla, Firefox and IE on Windows). I am not...
9
by: Frances Del Rio | last post by:
I have a pg with lots of divs, one of them is a gray bar about 150px down from the top and 20px from the left... this bar (an image) is 767px wide and 1px high.. however, even though all divs are...
18
by: Dennis | last post by:
It seems that garbage collection is somewhat flawed in Netscape as the following little script can bring a machine to its knees in about an hour when run on Netstcape 7.1. I've tried freeing the...
6
by: parksch2 | last post by:
Does anyone know why unescape would throw an error on certain special characters? I'm trying to unescape the string: Espa%F1ol It shou8ld display like this after it is unescaped: Español
2
by: Vik | last post by:
1. In IE 6.0, I can open a Web page http://localhost/MySite/MyPage.aspx, which connects to an SQL Server without asking for log in. In Netscape 7.1, the page requires log in. Provided the Windows...
6
by: qqq | last post by:
I'm a relative newbie... I'd like my site to support Netscape browsers. For a page I set 'TargetSchema' to 'IE 3.02/Netscape 3'. When I insert label or textbox web controls on the page, they...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.