In an ASP file, if the definition of the function F() is taken out from within <% %> and placed within
<script>
</script>
then the server returns with an error.
Is there some rule governing function placement?
<script>
</script>
<%
function F()
{
return 7.0;
}
var Seven = F();
Response.write("Seven = " + Seven);
%>
Thanks for the reply.
YES on your statements #1 (20 years at C++ taught me that) & #2.
#3: "ASP and JavaScript are (not) interchangeable": I never thought that they were interchangeable, just similar. In the example that I supplied, the syntax is acceptable in both locations, but a function defined withing <script> </script> is not callable within <% %>. That is the issue.
I stumble upon this anmomoly when I was using the syntax '... src= "..." ' as an "include" statement within <script> </script>. I have recently seen in the literature the syntax "#include" for ASP code. I'm looking into that now.
(p.s. If you were to view my profile, you might want to modify you moniker to "GrumpyNotSoOldMan"
As for your profile I could not care if you where Gates, Hickson or Crockford for that matter.
Your request showed a snippet of ASP (a server side scripting language) that was being dumped into some HTML script tags supposedly as JavaScript (a client side scripting language) and wondering why there was an error. Then in the same breath mentions they know they are not interchangeable. How bizarre?
If you are willing to rephrase your request so we do not need to view your profile and be mid readers then some-one will respond appropriately. I look forward to it.
My P.S., as indicated by the accompaning icon, was intended to interject a bit of potential humor relating to our relative ages.
Your moniker is apropos without modification.
Bookmarks