display return value of the function in a texbox

Discussion in 'JavaScript' started by claudi, Dec 11, 2007.

  1. #1
    <html>
    <head>

    <script type="text/javascript">
    function FormatXMLTime(aTime)
    {
    // Extract the date
    //
    var date = aTime.substring(0, aTime.indexOf("T", 0));

    // Remove the date.
    //
    var temp = aTime.replace(date, "");
    var temptime = temp.replace("T", "");

    // Extract the time.
    //
    var time = temptime.substring(0, temptime.indexOf("-", 0));

    return time;
    // return date + " " + time;
    }
    </script>

    </head>
    <body>

    <form>
    <input type="button"
    onclick="FormatXMLTime('2007-12-04T09:26:59.953+00:00')"
    value="Call function">
    </form>


    </body>
    </html>

    I have this code in my html file and I need the return value to be display in a textbox; is it possible?
     
    claudi, Dec 11, 2007 IP
  2. hrcerqueira

    hrcerqueira Peon

    Messages:
    125
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    like this:
    
    <input type="button" onclick="alert(FormatXMLTime('2007-12-04T09:26:59.953+00:00'))" value="Call function">
    
    Code (markup):
    ?
     
    hrcerqueira, Dec 11, 2007 IP