473,809 Members | 2,758 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="JavaS cript1.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="n o"
function inite() {
if (document.layer s) {
document.menu1. left=menuleft
document.menu1. top=menu1top

}
if (document.all) {
document.all.me nu1.style.posLe ft=menuleft
document.all.me nu1.style.posTo p=menu1top
}
}

function getmenuname(cli ckedmenu) {
if (menuismoving== "no") {
if (document.layer s) {
thismenu=eval(" document."+clic kedmenu)
}
if (document.all) {
thismenu=eval(" document.all."+ clickedmenu+".s tyle")
}
step=pace
checkdirection( )
movemenu()
}
}

function checkdirection( ) {
if (document.layer s) {
if
(thismenu==docu ment.menu1){vor zeimenu1=vorzei menu1*-1;vorzeichen=vo rzeimenu1}
}
if (document.all) {
if
(thismenu==docu ment.all.menu1. style){vorzeime nu1=vorzeimenu1 *-1;vorzeichen=vo rzeimenu1}
}
menuismoving="y es"
}

function movemenu() {
if (document.layer s) {
if (step>=0) {
thismenu.left+= step*vorzeichen
step--
var movetimer=setTi meout("movemenu ()",pause)
}
else {
menuismoving="n o"
clearTimeout(mo vetimer)
}
}
if (document.all) {
if (step>=0) {
thismenu.posLef t+=step*vorzeic hen
step--
var movetimer=setTi meout("movemenu ()",pause)
}
else {
menuismoving="n o"
clearTimeout(mo vetimer)
}
}
}
</script>

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

<BODY bgcolor="#99999 9" onLoad="inite() ">
<div align="center"> </div>
<DIV ID="menu1"><IM G SRC="webdesign. gif" USEMAP="#webdes ign.gif"
WIDTH=150 HEIGHT=93 BORDER=0>
<MAP NAME="webdesign .gif">
<AREA SHAPE=RECT COORDS="117,0,1 50,93"
HREF="javascrip t:getmenuname(' menu1')">
<AREA SHAPE=RECT COORDS="6,18,12 0,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="JavaS cript1.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="n o"
function inite() {
if (document.getEl ementById&&!doc ument.all) {
document.getEle mentById("menu1 ").style.left=m enuleft
document.getEle mentById("menu1 ").style.top=me nu1top

}
if (document.all) {
document.all.me nu1.style.posLe ft=menuleft
document.all.me nu1.style.posTo p=menu1top
}
}

function getmenuname(cli ckedmenu) {
if (menuismoving== "no") {
if (document.getEl ementById&&!doc ument.all) {

thismenu=eval(" document.getEle mentById('click edmenu').style" )
}
if (document.all) {
thismenu=eval(" document.all."+ clickedmenu+".s tyle")
}
step=pace
checkdirection( )
movemenu()
}
}

function checkdirection( ) {
if (document.getEl ementById&&!doc ument.all) {
if
(thismenu==docu ment.getElement ById("menu1").s tyle){vorzeimen u1=vorzeimenu1*-1;vorzeichen=vo rzeimenu1}
}
if (document.all) {
if
(thismenu==docu ment.all.menu1. style){vorzeime nu1=vorzeimenu1 *-1;vorzeichen=vo rzeimenu1}
}
menuismoving="y es"
}

function movemenu() {
if (document.getEl ementById&&!doc ument.all) {
if (step>=0) {
thismenu.left+= step*vorzeichen
step--
var movetimer=setTi meout("movemenu ()",pause)
}
else {
menuismoving="n o"
clearTimeout(mo vetimer)
}
}
if (document.all) {
if (step>=0) {
thismenu.posLef t+=step*vorzeic hen
step--
var movetimer=setTi meout("movemenu ()",pause)
}
else {
menuismoving="n o"
clearTimeout(mo vetimer)
}
}
}
</script>

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

<BODY bgcolor="#99999 9" onLoad="inite() ">
<div align="center"> </div>
<DIV ID="menu1"><IM G SRC="webdesign. gif" USEMAP="#webdes ign.gif"
WIDTH=150 HEIGHT=93 BORDER=0>
<MAP NAME="webdesign .gif">
<AREA SHAPE=RECT COORDS="117,0,1 50,93"
HREF="javascrip t:getmenuname(' menu1')">
<AREA SHAPE=RECT COORDS="6,18,12 0,74" HREF="http://www.cnet.com">
</MAP></DIV>

</body>

Jul 23 '05 #1
6 1532
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.layer s) {
document.menu1. left=menuleft
document.menu1. top=menu1top
"Document.layer s" is Netscape code up to version 4. Thereafter, it was
dropped and does not work. }
if (document.all) {
document.all.me nu1.style.posLe ft=menuleft
document.all.me nu1.style.posTo p=menu1top
}
}

"Document.a ll" 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.getEl ementById("id_r ef") 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.layer s) {
document.menu1. left=menuleft
document.menu1. top=menu1top

"Document.laye rs" is Netscape code up to version 4. Thereafter, it was
dropped and does not work.
}
if (document.all) {
document.all.me nu1.style.posLe ft=menuleft
document.all.me nu1.style.posTo p=menu1top
}
}

"Document.al l" 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.getEl ementById("id_r ef") 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.getEl ementById()) {
document.getEle mentById(your_e lement_id).styl e...
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.getEle mentById('click edmenu').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=docume nt.getElementBy Id('clickedmenu ').style

And:

thismenu=docume nt.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=docume nt.getElementBy Id(clickedmenu) .style
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>Docume nt Title</TITLE>

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

function init() {
document.getEle mentById("menu1 ").style.left=m enuleft
document.getEle mentById("menu1 ").style.top=me nu1top
nowpos=menuleft
}
function movemenu() {
if(dir==1){nowp os+= step}
if(dir==0){nowp os-= step}

document.getEle mentById("menu1 ").style.left=n owpos
movetimer=setTi meout("movemenu ()",pause)

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

if(nowpos<menul eft){
clearTimeout(mo vetimer)
dir=1
}

}

//-->
</script>

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

</HEAD>

<BODY bgcolor="#99999 9" onload="init()" >
<DIV ID="menu1"><IM G SRC="webdesign. gif" USEMAP="#webdes ign.gif"
WIDTH=150 HEIGHT=93 BORDER=0>
<MAP NAME="webdesign .gif">
<AREA SHAPE=RECT COORDS="117,0,1 50,93" HREF="#null"
onclick="moveme nu()">
<AREA SHAPE=RECT COORDS="6,18,12 0,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
1816
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 display(flash) { if (IE4) { document.all.style.visibility = "visible"; } if (agent.indexOf("mac") != -1) {
2
20949
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 when it's not hidden but I need to be able to make it hidden so I can use layers to show all when it finished drawing to make it smoother. This is how some other scripts are doing it that i've seen. So i've got it drawing a line and I need...
2
1431
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 be the problem? Thank you for your help.
7
2031
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. My page uses this dtd: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
17
3055
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 scroll right. Both of these issues occur in IE 6 but not in IE 5.5. You can get the horizontal scroll bar for the window by increasing the size of the image wider than the display area of the window. Assumes 600x800 default display size. Thanks...
2
3908
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 http://home.pacific.net.sg/~jacksony ? (the drop down bar could not work at www.apchosting.net but can drop at home.pacific.net.sg. I suspect it is a server problem but was told it is not possible, therefore assuming it is a client script problem? the script works last time...
10
54909
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 idea! function closeall() { var objs;
9
1952
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 worked perfectly (apart from the right hand scrollbar in IE). Picked up the page to be inserted ( http://sms.connexus.co.nz/sst/default.asp) and displayed it exactly as I hoped in both browsers. Great!
53
8431
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 language="javascript" type="text/javascript">
0
9601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10635
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10115
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3013
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.