SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: function show()

  1. #1
    SitePoint Zealot
    Join Date
    Mar 2011
    Posts
    146
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation function show()

    Hi,
    Ive come up with this but I couldn't get the numbers to display in the text field?

    Any ideas where i should start.

    <script type="text/javascript">


    var numbers = new Array();

    function insert(val)
    {
    numbers[numbers.length]= parseFloat(val);
    }

    function show()
    {
    var string="aa";
    for(i = 0; i < numbers.length; i++)
    {string=string+numbers[i]+"\n"}
    }
    alert(string);
    document.getElementById("e").value = string;


    function sum(numbers)
    {
    if (numbers.length == 0)
    for (i=0; i <array.length; i++)


    document.getElementById("Sum").value = total += numbers[i];return total;
    }

    function mean(numbers)
    {
    return numbers.length == 0 ? 0 : sum(numbers)/numbers.length;

    document.getElementById("answer") = mean(numbers).value;
    }


    </script>

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,191
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    I think this should be continued in your other post as the above won't work at all.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •