Rafael_Afonso 7 de mar. de 2003
Mostre o código de sua função.
thiagorani 7 de mar. de 2003
Bari,
Existe incompatibilidade de algumas sintaxe javascript para IE e Netscape.
É normal função javascript funcionar no IE e nao no Netscape.
Mando o codigo ae.
[]´s
rbarioni 7 de mar. de 2003
ai vai o codigo da minha funcao…
function Esconde & #40 ; & #41 ;
& #123 ;
& lt ; %
if & #40 ; strNumero == null & #41 ;
strNumero = "0" ;
%>
var valor = & lt ; %=strNumero%>;
window . alert & #40 ; valor & #41 ;;
if & #40 ; valor == "0" & #41 ; & #123 ;
window . alert & #40 ; "esconde" & #41 ;;
parent . Esconde & #40 ; "1" & #41 ;;
session . setAttribute & #40 ; "Numero" , "1" & #41 ;
return false ;
& #125 ;
if & #40 ; valor == "1" & #41 ; & #123 ;
window . alert & #40 ; "aparece" & #41 ;;
parent . Esconde & #40 ; "0" & #41 ;;
session . setAttribute & #40 ; "Numero" , "0" & #41 ;
return false ;
& #125 ;
& #125 ;
tentei atribuir minha variavel java a uma variavel javascript…mas na primeira vez ela vem NULL…mesmo o teste q faco no comeco da funcao, nao dah certo…o variavel ainda vem NULL…
alguem pode ajudar??
valew
Rafael_Afonso 7 de mar. de 2003
Vou chutar. Acho que na chamada da função JavaScript, você poderia colocar a sua String como argumento. No HTML, ficaria assim:
<... on???='Esconde(<%= (strNumero == null)? "0": strNumero %>)'/>
Sua função JS ficaria assim:
function Esconde & #40 ; valor & #41 ; & #123 ;
window . alert & #40 ; valor & #41 ;;
if & #40 ; valor == "0" & #41 ; & #123 ; ... }
if & #40 ; valor == "1" & #41 ; & #123 ; ... }
& #125 ;
thiagorani 7 de mar. de 2003
Barioni faz assim:
& lt ; %
String strNumero = & #40;request.getParameter("strNumero") != null?request.getParameter("strNumero"):"0");
%& gt ;
.
.
.
& lt ; script & gt ;
var valor = '< %s trNumero%>' ;
function Esconde & #40;)
& #123;
window . alert & #40;valor);
if & #40;valor=="0"){
window . alert & #40;"esconde");
parent . Esconde & #40;"1");
session . setAttribute & #40;"Numero","1")
return false ;
& #125;
if & #40;valor=="1"){
window . alert & #40;"aparece");
parent . Esconde & #40;"0");
session . setAttribute & #40;"Numero","0")
return false ;
& #125;
& #125;
& lt ; / script & gt ;
Puta gambiarra, mas deve funcionar.
[]´s
Rafael_Afonso 7 de mar. de 2003
Barioni:
Conseguiu resolver seu problema? Como? :?: