HELP: this menu slide script doesn't work on Mozilla
I've tried to modify this script to make it work on mozilla without success. Any help would be highly appreciatted. Thank you.
Original 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=vorzeimenu1*-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)
}
}
}
<!--end of oirginal script-->
************************
modified script (still not working, i wish i knew more JS ...)
************************
<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.getElementById&&!document.all) {
document.getElementById("menu1").style.left=menuleft
document.getElementById("menu1").style.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.getElementById&&!document.all) {
thismenu=eval("document."+"getElementById('"+clickedmenu+"')"+".style")
}
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.getElementById&&!document.all) {
if (thismenu==document.getElementById("menu1").style){vorzeimenu1=vorzeimenu1*-1;vorzeichen=vorzeimenu1}
}
if (document.all) {
if (thismenu==document.all.menu1.style){vorzeimenu1=vorzeimenu1*-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.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)
}
}
}
Sorry - wrong changed script (this is the right one)
sorry about that. this is the modified 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.getElementById&&!document.all) {
document.getElementById("menu1").style.left=menuleft
document.getElementById("menu1").style.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.getElementById&&!document.all) {
thismenu=eval("document.getElementById('clickedmenu').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=vorzeimenu1*-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)
}
}
}
I'm unable ot add more than one menu-tab (when added they both move at the same time)
Thank you again for your help. when i add more than 1 tab, with different names (menu1, 2) i fail to make them move independently. sorry about my lack of knowledge in JS, your help will be appreciatted.
SC
Quote:
Originally Posted by Mr J
The following example will work in IE6, Mozilla, and NS7
<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=menuleft
document.getElementById("menu1").style.top=menu1top
nowpos=menuleft
}
function movemenu() {
if(dir==1){nowpos+= step}
if(dir==0){nowpos-= step}