0

Hi,i have a table like this :

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">

        <title></title>
        <style>
    table{border-collapse: collapse;}
    tr th, tr td{border: 1px solid black;}
   #resize
   {
       width :100%;
       position: relative;
   }
</style>
    </head>
    <body>

        <?php



    $rows = 10;
$columns = 6; //count of cols from WP to PR
$table = '';
for($r=0;$r<$rows;$r++) {
    $table .= "<tr><td>K" . str_pad(($r+1),3,'0',STR_PAD_LEFT) . "</td>".'<th></th>';
    for($c=0;$c<$columns;$c++){
        $table .= "<td>".mt_rand(1,100)."</td>";


    }
    $table .= '</tr>';



     //$table.='</th>';


}
       ?>
        <?php

       $val= $_GET(['knum']);
       echo $val;
        ?>

    <div id="resize">
    <table width ="100%" class="t1">
        <tr>
            <th id="knum">knumber</th>
            <th>Average</th>
            <th>WP</th>
            <th>WD</th>
            <th>ID</th>
            <th>DV</th>
            <th>HC</th>
            <th id="avr">PR</th>


        </tr>
        <tr></tr>

        <?=$table?>
    </table>

</div>


    </body>
</html>

how would i apply jquary or java script to find average for each of the rows? Thanks

3
Contributors
4
Replies
17
Views
2 Years
Discussion Span
Last Post by LibraryCode
1

Hi librarycode,

please give us some clarity on your code. so that we can give a best way to solve/guide your question [like how the output will be or your code result is like this or ...etc]

thanks

Edited by ihelpyou: need clarity on the post

0

Sorry for confusion,my question is: have the html table with random numbers,how would i calculate an average of each row?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.