SitePoint Sponsor

User Tag List

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

    Thumbs up undefined values

    Hi,

    I have this html/jscript hybrid and when i run it in firefox

    the error console says a value is undefined

    when i click it

    the very first <html> is highlighted????

    any one no why?:thumbsup:

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,189
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    What is the full JS code your using?

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2011
    Posts
    146
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    The full js code is below i haven't got the last two functions to work yet.
    I figure i need the first two first?


    <script type="text/javascript">


    var numbers = new Array();

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


    function show()
    {
    var string="";
    for(i = 0; i < numbers.length; i++)
    {
    string += array[i] +"\n";
    }


    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>


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
  •