473,383 Members | 1,872 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,383 software developers and data experts.

HELP: Problem with Mozilla - Netscape and moving layers

GD
I'm using a script that works great on IE, but not on mozilla. the
original one worked also on N4, but i'd like it to be funcional with
mozilla.

this is the orginal script:

*****************************
<Head>
<script language="JavaScript1.2">
var menu1top=230
var menuleft=-115
var pace=14

var step
var direction
var pause=25

var thismenu
var vorzeichen=1
var vorzeimenu1=-1
var menuismoving="no"
function inite() {
if (document.layers) {
document.menu1.left=menuleft
document.menu1.top=menu1top

}
if (document.all) {
document.all.menu1.style.posLeft=menuleft
document.all.menu1.style.posTop=menu1top
}
}

function getmenuname(clickedmenu) {
if (menuismoving=="no") {
if (document.layers) {
thismenu=eval("document."+clickedmenu)
}
if (document.all) {
thismenu=eval("document.all."+clickedmenu+".style" )
}
step=pace
checkdirection()
movemenu()
}
}

function checkdirection() {
if (document.layers) {
if
(thismenu==document.menu1){vorzeimenu1=vorzeimenu1 *-1;vorzeichen=vorzeimenu1}
}
if (document.all) {
if
(thismenu==document.all.menu1.style){vorzeimenu1=v orzeimenu1*-1;vorzeichen=vorzeimenu1}
}
menuismoving="yes"
}

function movemenu() {
if (document.layers) {
if (step>=0) {
thismenu.left+=step*vorzeichen
step--
var movetimer=setTimeout("movemenu()",pause)
}
else {
menuismoving="no"
clearTimeout(movetimer)
}
}
if (document.all) {
if (step>=0) {
thismenu.posLeft+=step*vorzeichen
step--
var movetimer=setTimeout("movemenu()",pause)
}
else {
menuismoving="no"
clearTimeout(movetimer)
}
}
}
</script>

<style type="text/css">
#menu1 {position:absolute;left:-1000px;}
.baseline {
position:absolute;
left:250px;
top:20px;
font-family:Arial;
font-size:9pt;
color:000000;
}
</STYLE>
</head>

<BODY bgcolor="#999999" onLoad="inite()">
<div align="center"> </div>
<DIV ID="menu1"><IMG SRC="webdesign.gif" USEMAP="#webdesign.gif"
WIDTH=150 HEIGHT=93 BORDER=0>
<MAP NAME="webdesign.gif">
<AREA SHAPE=RECT COORDS="117,0,150,93"
HREF="javascript:getmenuname('menu1')">
<AREA SHAPE=RECT COORDS="6,18,120,74" HREF="http://www.cnet.com">
</MAP></DIV>

</body>

<!--endo original script-->
*************************************

I modified it to try to make it work with mozilla, but it still
doesn't work. here is the modified script- thank you very much for
your help. GD
<Head>
<script language="JavaScript1.2">
var menu1top=230
var menuleft=-115
var pace=14

var step
var direction
var pause=25

var thismenu
var vorzeichen=1
var vorzeimenu1=-1
var menuismoving="no"
function inite() {
if (document.getElementById&&!document.all) {
document.getElementById("menu1").style.left=menule ft
document.getElementById("menu1").style.top=menu1to p

}
if (document.all) {
document.all.menu1.style.posLeft=menuleft
document.all.menu1.style.posTop=menu1top
}
}

function getmenuname(clickedmenu) {
if (menuismoving=="no") {
if (document.getElementById&&!document.all) {

thismenu=eval("document.getElementById('clickedmen u').style")
}
if (document.all) {
thismenu=eval("document.all."+clickedmenu+".style" )
}
step=pace
checkdirection()
movemenu()
}
}

function checkdirection() {
if (document.getElementById&&!document.all) {
if
(thismenu==document.getElementById("menu1").style) {vorzeimenu1=vorzeimenu1*-1;vorzeichen=vorzeimenu1}
}
if (document.all) {
if
(thismenu==document.all.menu1.style){vorzeimenu1=v orzeimenu1*-1;vorzeichen=vorzeimenu1}
}
menuismoving="yes"
}

function movemenu() {
if (document.getElementById&&!document.all) {
if (step>=0) {
thismenu.left+=step*vorzeichen
step--
var movetimer=setTimeout("movemenu()",pause)
}
else {
menuismoving="no"
clearTimeout(movetimer)
}
}
if (document.all) {
if (step>=0) {
thismenu.posLeft+=step*vorzeichen
step--
var movetimer=setTimeout("movemenu()",pause)
}
else {
menuismoving="no"
clearTimeout(movetimer)
}
}
}
</script>

<style type="text/css">
#menu1 {position:absolute;left:-1000px;}
.baseline {
position:absolute;
left:250px;
top:20px;
font-family:Arial;
font-size:9pt;
color:000000;
}
</STYLE>
</head>

<BODY bgcolor="#999999" onLoad="inite()">
<div align="center"> </div>
<DIV ID="menu1"><IMG SRC="webdesign.gif" USEMAP="#webdesign.gif"
WIDTH=150 HEIGHT=93 BORDER=0>
<MAP NAME="webdesign.gif">
<AREA SHAPE=RECT COORDS="117,0,150,93"
HREF="javascript:getmenuname('menu1')">
<AREA SHAPE=RECT COORDS="6,18,120,74" HREF="http://www.cnet.com">
</MAP></DIV>

</body>

Jul 23 '05 #1
6 1500
GD wrote:
I'm using a script that works great on IE, but not on mozilla. the
original one worked also on N4, but i'd like it to be funcional with
mozilla.

function inite() {
if (document.layers) {
document.menu1.left=menuleft
document.menu1.top=menu1top
"Document.layers" is Netscape code up to version 4. Thereafter, it was
dropped and does not work. }
if (document.all) {
document.all.menu1.style.posLeft=menuleft
document.all.menu1.style.posTop=menu1top
}
}

"Document.all" is Microsoft code and does not work (except on those,
such as Opera, which can mimic Microsoft-code).

The net effect you have is that you do not use *any* W3C-standard code
and therefore your script will not work withe modern browsers. Switch to
using the "document.getElementById("id_ref") methods.
Jul 23 '05 #2
GD
Thank you for your advise.

i've changed what you suggested, but somehow the last statement still
doesn't in Mozilla. in fact i got rid of most "if"and it works on IE,
but not Netscape.
Any idea why?

thanks,
GD

GD wrote:
I'm using a script that works great on IE, but not on mozilla. the
original one worked also on N4, but i'd like it to be funcional with
mozilla.

function inite() {
if (document.layers) {
document.menu1.left=menuleft
document.menu1.top=menu1top

"Document.layers" is Netscape code up to version 4. Thereafter, it was
dropped and does not work.
}
if (document.all) {
document.all.menu1.style.posLeft=menuleft
document.all.menu1.style.posTop=menu1top
}
}

"Document.all" is Microsoft code and does not work (except on those,
such as Opera, which can mimic Microsoft-code).

The net effect you have is that you do not use *any* W3C-standard code
and therefore your script will not work withe modern browsers. Switch to
using the "document.getElementById("id_ref") methods.


Jul 23 '05 #3
GD wrote:
Thank you for your advise.

i've changed what you suggested, but somehow the last statement still
doesn't in Mozilla. in fact i got rid of most "if"and it works on IE,
but not Netscape.
Any idea why?

In place of *both* your "if" statements, you can use the following:-

if (document.getElementById()) {
document.getElementById(your_element_id).style...
etc.

This replaces all your "browser detection" with detecting the capability
of the browser rather than the manufacturer. Should it fail that test
(so, obviously, in an "else" clause) you can then run your browser
detection to deal with older browsers. There are more detailed examples
of this sort of thing in the group FAQ.
Jul 23 '05 #4
GD wrote:
I'm using a script that works great on IE, but not on mozilla. the
original one worked also on N4, but i'd like it to be funcional with
mozilla.
(snip)
I modified it to try to make it work with mozilla, but it still
doesn't work. here is the modified script- thank you very much for
your help. GD
(snip)
thismenu=eval("document.getElementById('clickedmen u').style")


(snip)

Terrible script, with all that eval()ing...the above bit should
illustrate why. You're passing the string 'clickedmenu' to the
function, not the string contained in the variable clickedmenu.

thismenu=document.getElementById('clickedmenu').st yle

And:

thismenu=document.all[clickedmenu].style

There are so many menu scripts floating around these days, of every
variety, there's no reason to waste any time modifying relics of this
sort.

http://www.dyn-web.com/dhtml/slide/slide-out-menus.html

Jul 23 '05 #5
thismenu=document.getElementById(clickedmenu).styl e
Apologies (it's Monday here)...

Jul 23 '05 #6
GD
Thanks for your answer and the link, it's a great resource for scripts
and to learn DHTML.

somebody sent me the following script that works great. i'm unable to
add more than one tab though (i'm in the process of learning JS thru
other peoples scripts and website tutorials). what i like about it is
the use of image maps instead of styles for the menus for design
purposes. any help will be greatly appreciatted.

thanks, GD

***************************************

<HTML>
<HEAD>
<TITLE>Document Title</TITLE>

<script language="javascript">
<!--
var menu1top=230
var menuleft=-115
var step = 10
var pause=50
var dir=1

function init() {
document.getElementById("menu1").style.left=menule ft
document.getElementById("menu1").style.top=menu1to p
nowpos=menuleft
}
function movemenu() {
if(dir==1){nowpos+= step}
if(dir==0){nowpos-= step}

document.getElementById("menu1").style.left=nowpos
movetimer=setTimeout("movemenu()",pause)

if(nowpos>0-step){
clearTimeout(movetimer)
dir=0
}

if(nowpos<menuleft){
clearTimeout(movetimer)
dir=1
}

}

//-->
</script>

<style type="text/css">
#menu1 {position:absolute;}
..baseline {
position:absolute;
left:250px;
top:20px;
font-family:Arial;
font-size:9pt;
color:000000;
}
</STYLE>

</HEAD>

<BODY bgcolor="#999999" onload="init()">
<DIV ID="menu1"><IMG SRC="webdesign.gif" USEMAP="#webdesign.gif"
WIDTH=150 HEIGHT=93 BORDER=0>
<MAP NAME="webdesign.gif">
<AREA SHAPE=RECT COORDS="117,0,150,93" HREF="#null"
onclick="movemenu()">
<AREA SHAPE=RECT COORDS="6,18,120,74" HREF="http://www.cnet.com">
</MAP></DIV>

</BODY>
</HTML>

Jul 23 '05 #7

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

Similar topics

2
by: Key Bohn | last post by:
var NN4 = document.layers? true : false; //Netscape Navigator 4.x. var IE4 = document.all? true : false; // IE version 4 and above. var agent = navigator.userAgent.toLowerCase(); function...
2
by: Gary Mayor | last post by:
Hi, I'm back again. Basically i'm trying to draw a box over an image which is turning out to be a nightmare. The problem i'm getting at the moment is that i'm creating a line with <div which works...
2
by: ALuPin | last post by:
Hi, when I try to see the effect of the following script I do not see anything when using Netscape Navigator whereas InternetExplorer ist ok. In Netscape Javascript is activated. What could...
7
by: Paul Marsh | last post by:
Hello everyone, I am attempting to create a xhtml page that uses a bit of dhtml. The javascript I am using uses document.getElementById('someId').style.someProperty; and is and external script....
17
by: George Hester | last post by:
http://tinyurl.com/5uj6w The lower middle icon the "block" should not drop down when the mouse is over it. How can I stop that? Also the navigation divs both top and bottom should follow the...
2
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at...
10
by: InvisibleMan | last post by:
Hi, Thanks for any help in advance... Okay, I have the JS listed below that calls for the display of the (DIV) tag... cookie function not included, as don't feel its necessary but you'll get the...
9
by: Peter Jenkins | last post by:
I needed to implement a "page within a page" and rather than use frames (yecchh) decided to try using the object tag. Flung a test page together, tried it out in IE and Firefox on my PC, it...
53
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.