Loading ...

Print the source code of a function

Who is online?  0 guests and 0 members
home  »  forums   »  asp.net topics   »  client side web development   » Print the source code of a function

Print the source code of a function

Posts under the topic: Print the source code of a function

Posted: 6/9/2010

Lurker 235  points  Lurker
  • Joined on: 10/16/2009
  • Posts: 47

Hi Experts,

I need to print the source code a function. I know how to execute the function but I dont know how to print the source code of this function.


Posted: 6/9/2010

Professional 8495  points  Professional
  • Joined on: 5/3/2010
  • Posts: 389

duplicate post


Posted: 6/9/2010

Professional 8495  points  Professional
  • Joined on: 5/3/2010
  • Posts: 389

duplicate post


Posted: 6/9/2010

Professional 8495  points  Professional
  • Joined on: 5/3/2010
  • Posts: 389

What language?

I see you have posted about printing all properties of a n Object in JavaScript language where I already wrote an answer. Do you want to do this for JavaScript again or???

Im not sure if you are going to be able to do that easily.

Maybe you want to make something like source code snippets, showing the html code on html page?

Example:

        <pre>
            <code>
                &lt;html&gt;
                    &lt;body&gt;
                   
                        page content
               
                    &lt;/body&gt;               
                &lt;/html&gt;
            </code>
        </pre>

Result:

                <html>
<body>

page content

</body>
</html>

 

using &lt; for < and &gt; for > you can escape the special characters. Try it


Posted: 6/11/2010

Guru 16518  points  Guru
  • Joined on: 4/19/2009
  • Posts: 483
  Answered

There is tostring() method for it. Try this sample code:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">

        function test() {
            alert('This is my test string');
        }

        alert(test.toString());
    </script>
</head>
<body>

</body>
</html>



tags javascript
Page 1 of 1 (5 items)