How do I write an .asp file if a condition in JAVASCRIPT?
NOTE: I can already write files in a quiet .asp file.
Below the source portion as an example:
<script>
if(1 == 2) { // ISSO É FALSO, PORTANTE ELE DEVE IR PARA O ELSE, POREM ELE FAZ TODO ASP
<%
oStream.WriteLine "ESCREVE LINHA 2"
If (1 = 1) Then 'IF DO ASP, SE 1 = 2, ELE NÃO ESCREVE , ESTÁ OK
oStream.WriteLine "ESCREVE LINHA 3"
End If
%>
} else {
<% oStream.WriteLine "ESCREVE FIM" %>
}
So when the javascript condition is false, it does not respect, and does all ASP.
The result of my file is:
...
WRITE LINE 2 // THAT SHOULD NOT HAVE
WRITE LINE 3 // NOR THAT
WRITE AT END ...
I tried to color the entire font for you to test, but I can not get a bug in the editor.
Real Source:
if (frm['MAPA'].window.ChecarDentroDoPonto('VEICULOS', '{<%=rs("VeiculoID")%>-<%=rsPosicao("VeiculoLogID")%>}', '{<%=strChaveRotaP%>}') == false) {
document.write('<input type="hidden" name="SQL" value="UPDATE VeiculosLogsAuxiliar SET RotaP=\'A\' WHERE PrefixoView=\'<%=rs("PrefixoView")%>\' AND VeiculoLogID=<%=rsPosicao("VeiculoLogID")%>">');
<% If IsNull(strEmailNew) = False Then
If InStr(1, strEmailNew, "@") > 0 Then %>
document.write('<input type="hidden" name="AlertaEmailVeiculoID" value="<%=rs("VeiculoID")%>">');
document.write('<input type="hidden" name="AlertaEmailAlerta" value="ROTAP<%=lngRotaPID%>-<%=lngPontoIDAtual%>">');
document.write('<input type="hidden" name="AlertaEmailEmail" value="<%=strEmailNew%>">');
document.write('<input type="hidden" name="AlertaEmailTitulo" value="<%=strEmpresa & " - ALERTA - " & rsPosicao("DtLog")%>">');
document.write('<input type="hidden" name="AlertaEmailMensagem" value="<%="Cliente: " & rs("NomeFantasia") & "<br>" & "Veículo: " & rs("VeiculoID") & " - " & rs("Placa") & " - " & rs("Descricao") & "<br>" & "Atrasado na rota \'" & strRotaPDescricao & "\'" %>">');
<%
End If
End If
%>
</script>