Sign in to follow this  
Gnomo

Codigo não Funciona O Ff

Recommended Posts

e aí galera...

eu tenho esse codigo aqui

mais ele não funciona no firefox...

alguém pode me dizer porque?

Abaixo codigo:

if(window.top != window.self){
    window.top.location = window.self.location;
}

var Menus = new Array(3);
Menus[0] = new Menu('Conteúdo','Conteudo.asp');
Menus[1] = new Menu('Relatórios','Relatorios.asp');
Menus[2] = new Menu('Administração','Administradores.asp');

function window.onload() {
    Muda(0);
}

function GeraMenu() {
    var strFinal = '';
    strFinal = strFinal + '<TABLE border=0 cellpadding=0 cellspacing=0 height=25><TR>';
    for (i = 0; i < Menus.length; i++) {
        if(Menus[i].status == true) {
            strFinal = strFinal + '<TD id=' + Menus[i].tid + '><TABLE border=0 cellpadding=0 cellspacing=0><TR><TD><IMG height=25 src=img/mn-sel-e.gif width=2></TD><TD background=img/mn-sel-f.gif valign=bottom><SPAN class=mn-sel>' + Menus[i].nome + '</SPAN><BR><IMG height=3 src=img/b.gif width=1></TD><TD><IMG height=25 src=img/mn-sel-d.gif width=1></TD></TR></TABLE></TD>';
        } else {
            strFinal = strFinal + '<TD id=' + Menus[i].tid + '><A class=mplk href="java script:Muda(' + i + ');"><SPAN class=mn-t1>' + Menus[i].nome + '</SPAN><BR><SPAN class=mn-t2 id=' + Menus[i].gid + '>' + Menus[i].nome + '</SPAN><BR></A></TD>';
        }
        if ((i + 1) < Menus.length) 
            if(Menus[i].status == false && Menus[i + 1].status == false)
                strFinal = strFinal + '<TD><FONT class=mn-sep>|</FONT></TD>';
    }
    strFinal = strFinal + '</TR></TABLE>';
    return strFinal;
}

function Menu(nome, link) {
    d = new Date();
    r = Math.ceil(Math.random() * 1000);
    this.nome = nome;
    this.link = link;
    this.gid = 'mnid' + d.getTime() + '_' + r;
    this.tid = 'tdid' + d.getTime() + '_' + r;
    this.status = false;
}

function Muda(mn) {
    for (i = 0; i < Menus.length; i++) {
        Menus[i].status = false;
    }
    Menus[mn].status = true;
    menubarra.innerHTML = GeraMenu();
    window.admin.document.location = Menus[mn].link;
}  

Desde já agradeço...

Share this post


Link to post
Share on other sites

não estou com firefox aqui pois estou na lan;

Entaum vou dizer o que acho:

você tem que colocar "menubarra.innerHTML" desse jeito:

"document.getElementById("menubarra").innerHTML"

Se não der certo você faiz assim

Abre essa script no FF e em ferramentas ou sei lá procura um negócio escrito console de javascript lá ele vai acusar o erro com detalhes

desde linha, até o erro...

T+

Share this post


Link to post
Share on other sites

Kara seu erro é nessa parte

function window.onload{
muda(0);
}
<script>
if(window.top != window.self){
    window.top.location = window.self.location;
}

var Menus = new Array(3);
Menus[0] = new Menu('Conteúdo','Conteudo.asp');
Menus[1] = new Menu('Relatórios','Relatorios.asp');
Menus[2] = new Menu('Administração','Administradores.asp');

function GeraMenu() {
    var strFinal = '';
    strFinal = strFinal + '<TABLE border=0 cellpadding=0 cellspacing=0 height=25><TR>';
    for (i = 0; i < Menus.length; i++) {
        if(Menus[i].status == true) {
            strFinal = strFinal + '<TD id=' + Menus[i].tid + '><TABLE border=0 cellpadding=0 cellspacing=0><TR><TD><IMG height=25 src=img/mn-sel-e.gif width=2></TD><TD background=img/mn-sel-f.gif valign=bottom><SPAN class=mn-sel>' + Menus[i].nome + '</SPAN><BR><IMG height=3 src=img/b.gif width=1></TD><TD><IMG height=25 src=img/mn-sel-d.gif width=1></TD></TR></TABLE></TD>';
        } else {
            strFinal = strFinal + '<TD id=' + Menus[i].tid + '><A class=mplk href="java script:Muda(' + i + ');"><SPAN class=mn-t1>' + Menus[i].nome + '</SPAN><BR><SPAN class=mn-t2 id=' + Menus[i].gid + '>' + Menus[i].nome + '</SPAN><BR></A></TD>';
        }
        if ((i + 1) < Menus.length)
            if(Menus[i].status == false && Menus[i + 1].status == false)
                strFinal = strFinal + '<TD><FONT class=mn-sep>|</FONT></TD>';
    }
    strFinal = strFinal + '</TR></TABLE>';
    return strFinal;
}

function Menu(nome, link) {
    d = new Date();
    r = Math.ceil(Math.random() * 1000);
    this.nome = nome;
    this.link = link;
    this.gid = 'mnid' + d.getTime() + '_' + r;
    this.tid = 'tdid' + d.getTime() + '_' + r;
    this.status = false;
}

function Muda(mn) {
    for (i = 0; i < Menus.length; i++) {
        Menus[i].status = false;
    }
    Menus[mn].status = true;
    document.getElementById("menubarra").innerHTML = GeraMenu();
    window.admin.document.location = Menus[mn].link;
}  
</script>
<body onload="Muda(0)">
<div id="menubarra"></div>

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this