How do I create a Javascript function within the *.AVFP file?

Topics: Developer Forum, Project Management Forum, User Forum
Feb 22 at 7:52 AM
How do I create a Javascript function within the *.AVFP file?
<!--The HTML/Javascript below works --> <!doctype>
    <html>
        <title>Alert</title>
        <body>
            <script  type="text/javascript">
                var lcName="Alert Test"
                 alert(lcName+" is working.")
            </script>
        </body>
    </html>

<!--The HTML/Javascript Function below does not work, But it does not work using the Javascript “Function” (although the simulair code above works) ...Why? --> <!DOCTYPE>
    <html>
        <title>Alert</title>
        <body>
                <script TYPE="TEXT/JAVASCRIPT">
                    FullName("Function Test");
                    FUNCTION FullName(lcName)
                    {
                     alert(lcName+" is not working...Why?");
                    }
                </script>
        </body>
    </html>
Coordinator
Feb 23 at 8:36 PM
Edited Feb 23 at 8:38 PM
First your function needs to be triggered. Second javascript is case sensitive.
<html>
    <title>Alert</title>
    <body>
        <button onclick="FullName('XXX')">TEST</button>
            <script TYPE="TEXT/JAVASCRIPT">
                function FullName(lcName)
                {
                 alert(lcName +" is not working...Why?");
                }
            </script>
    </body>
</html>
Feb 26 at 7:59 PM
Thanks Apaustria,
but how you going to pass the parameter or define the lcName parameter?
Coordinator
Mar 31 at 10:40 PM
Put the VFP parameter like this: FullName("<%=lCname%>")