Ir para conteúdo
Fórum Script Brasil
  • 0

Funçoes/ Style


RC@

Pergunta

Ola pessoal...

é o seguinte..

Eu criei as seguintes funcoes em java script:

function preload() {
    sabado.style.display = 'none';
    segunda[0].style.display = 'none';
    segunda[1].style.display = 'none';
    segunda[2].style.display = 'none';
    terca[0].style.display = 'none';
    terca[1].style.display = 'none';
    terca[2].style.display = 'none';
    terca[3].style.display = 'none';
    quarta[0].style.display = 'none';
    quarta[1].style.display = 'none';
    quarta[2].style.display = 'none';
    quinta[0].style.display = 'none';
    quinta[1].style.display = 'none';
}

function showhide(what){

if (what == segunda) {

    if(segunda[0].style.display == 'none')
        segunda[0].style.display='';
    else
        segunda[0].style.display='none';

    if(segunda[1].style.display == 'none')
        segunda[1].style.display='';
    else
        segunda[1].style.display='none';

    if(segunda[2].style.display == 'none')
        segunda[2].style.display='';
    else
        segunda[2].style.display='none';
}

if (what == terca) {

    if(terca[0].style.display == 'none')
        terca[0].style.display='';
    else
        terca[0].style.display='none';

    if(terca[1].style.display == 'none')
        terca[1].style.display='';
    else
        terca[1].style.display='none';

    if(terca[2].style.display == 'none')
        terca[2].style.display='';
    else
        terca[2].style.display='none';

    if(terca[3].style.display == 'none')
        terca[3].style.display = '';
    else
        terca[3].style.display = 'none';    
}

if (what == quarta) {

    if(quarta[0].style.display == 'none')
        quarta[0].style.display='';
    else
        quarta[0].style.display='none';

    if(quarta[1].style.display == 'none')
        quarta[1].style.display='';
    else
        quarta[1].style.display='none';

    if(quarta[2].style.display == 'none')
        quarta[2].style.display='';
    else
        quarta[2].style.display='none';
}

if (what == quinta) {

    if(quinta[0].style.display == 'none')
        quinta[0].style.display='';
    else
        quinta[0].style.display='none';

    if(quinta[1].style.display == 'none')
        quinta[1].style.display='';
    else
        quinta[1].style.display='none';

}

    if (what.style.display=='none'){
        what.style.display='';
    }
    else{
        what.style.display='none';
    }
}
Bom, a preload() serve pra que, quando a pagina for carregada, os style,display sejam setados para "none"... (sem isso.. eles apareciam... não sei porque..mas blza.. ) A funcao showhide, serve pra mostrar akilo que está escondido.. ou esconder de novo.. Faço a chamada da função da seguinte maneira:
<img src="figuras/sabado.jpg" class="mouse" onClick="showhide(sabado)" width="200" height="40" />
Nesse caso ai.. quando eu clicar na figura.. é pra aparecer o conteudo de "sabado".. que no caso é:
<tr id="sabado" style="display:'none'">

Bom.. Tudo isso funciona perfeitamente no IE e no Opera.. Mas no firefox.. nada de funcionar..

Sei que tem algumas diferenças pra usar javascript no firefox.. como eu poderia fazer funcionar???

alguém tem alguma ideia???

Obrigado

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...