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

Problema Com Array


Guest - Lima -

Pergunta

PessoALL,

Estou gerando javascript dinamicamente em ASP, este array é bidimensional.

Aparentemente ele gera direitinho, porém, quando resgato os valores do array, a impressão que tenho é que os valores são sempre iguais, como se o mesmo só tivesse os valores da última posição.

Alguém tem alguma idéia ?

Vejam o código gerado:

<script>

var arCmtType = new Array( 8 );

var nK;

arCmtType[ 0 ] = new Array(5) ;

arCmtType[ 0, 0 ] = 1;

arCmtType[ 0, 1 ] = 1;

arCmtType[ 0, 2 ] = 2;

arCmtType[ 0, 3 ] = 3;

arCmtType[ 0, 4 ] = 30;

arCmtType[ 1 ] = new Array(5) ;

arCmtType[ 1, 0 ] = 2;

arCmtType[ 1, 1 ] = 2;

arCmtType[ 1, 2 ] = 1;

arCmtType[ 1, 3 ] = 2;

arCmtType[ 1, 4 ] = 40;

arCmtType[ 2 ] = new Array(5) ;

arCmtType[ 2, 0 ] = 3;

arCmtType[ 2, 1 ] = 2;

arCmtType[ 2, 2 ] = 2;

arCmtType[ 2, 3 ] = 2;

arCmtType[ 2, 4 ] = 45;

arCmtType[ 3 ] = new Array(5) ;

arCmtType[ 3, 0 ] = 4;

arCmtType[ 3, 1 ] = 2;

arCmtType[ 3, 2 ] = 2;

arCmtType[ 3, 3 ] = 5;

arCmtType[ 3, 4 ] = 50;

arCmtType[ 4 ] = new Array(5) ;

arCmtType[ 4, 0 ] = 5;

arCmtType[ 4, 1 ] = 2;

arCmtType[ 4, 2 ] = 2;

arCmtType[ 4, 3 ] = 2;

arCmtType[ 4, 4 ] = 30;

arCmtType[ 5 ] = new Array(5) ;

arCmtType[ 5, 0 ] = 6;

arCmtType[ 5, 1 ] = 2;

arCmtType[ 5, 2 ] = 2;

arCmtType[ 5, 3 ] = 2;

arCmtType[ 5, 4 ] = 30;

arCmtType[ 6 ] = new Array(5) ;

arCmtType[ 6, 0 ] = 7;

arCmtType[ 6, 1 ] = 1;

arCmtType[ 6, 2 ] = 2;

arCmtType[ 6, 3 ] = 3;

arCmtType[ 6, 4 ] = 30;

arCmtType[ 7 ] = new Array(5) ;

arCmtType[ 7, 0 ] = 8;

arCmtType[ 7, 1 ] = 1;

arCmtType[ 7, 2 ] = 2;

arCmtType[ 7, 3 ] = 3;

arCmtType[ 7, 4 ] = 30;

//alert( 'arCmtType.length = ' + arCmtType.length );

</script>

Link para o comentário
Compartilhar em outros sites

1 resposta 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,2k
    • Posts
      651,9k
×
×
  • Criar Novo...