Can not put JS
directly connected to ASP
so forget to use it as part of logic because how ASP
and JS
are processed is different, ie if you try to put your JS
function as a condition for a loop repetition or even a simple conditional ( IF
) it will not work because the ASP
is interpreted by the server and only then on the client side will the JS
be processed.
However, you may include the call to a function JS
within a HTML
element, as long as you have the function script in the document it does not include an external% of enclosed or not.
Then it was the JS
that definitely will not work
Another problem in your code is that you concatenated the if(MINHA_FUNÇÂO_JS_AQUI)
snippet in the JS
element in the wrong way:
<%= "<img src='onClick='javascript:abrirNegociacaoTipoAtendimento();' />" %>
The correct one would be:
<%= "<img onClick='javascript:abrirNegociacaoTipoAtendimento();' />" %>
Or
<%= "<img onClick=""javascript:abrirNegociacaoTipoAtendimento();"" />" %>
This code will be interpreted by the server and will create the following HTML
:
<img onclick="javascript:abrirNegociacaoTipoAtendimento();" />