How to assign value to a variable based on IF sentences and the Alert? in JavaScript
Hi, I have this Code that works when I shows the results using Alerts on both cases, basically I evaluate the Visible Status of two controls using Jquery.
If pnlResultados is visible, shows: No Results or No hay Resultados If PnlNoResultados is visible, shows: Results Available or Si Hay Resultados.
So this is my code:
Dim Banner As String = "setDDLday();
var HayDescargaSiONo = 's';
function setDDLday() {
setTimeout(VerificaResultados,100);
function VerificaResultados() {
if ($('#ctl00_MainContent_PnlNoResultados').css('display') != 'none') {
HayDescargaSiONo ='No Hay Resultados';
} else if ($('#ctl00_MainContent_PnlResultados').is(':visible')) {
HayDescargaSiONo ='Si Hay Resultados';
} else {
setTimeout(VerificaResultados,100);
};
};
alert (HayDescargaSiONo);
}"
When I put Alert in the next line after I assign a value It shows the result: Ex. "No Hay Resultados". But If I want to get the alert the value of HayDescargaSiONo Variable it said me: "Undefined" and also Is fired faster than the normal, so I can get a value.
What Am I doing wrong?
I want to assign a Value to the HayDescargaSiONo Variable.
If meets the first Condition, then Equals "No" Else If meets the Second Condition, then Equals "Yes".
Aucun commentaire:
Enregistrer un commentaire