我如何使用onclick进行此工作

How can i make this work.

<a href="#" onClick="javascript.functiontoget$date();">'.$date.'</a>

the $date value is inside the while loop

while($row = mysqli_fetch_array($query)){
$date = $row['Date'];
echo '<tr class="normalRow"><td><a href="#" onClick="javascript.functiontoget$date();">$date</a></td></tr>;'
    }

Variables aren't expanded inside single-quotes strings, only double-quoted strings. You need to use concatenation.

echo '<tr class="normalRow"><td><a href="#" onClick="javascript.functiontoget$date();">' . $date . '</a></td></tr>;'

So either set the date in the method you are calling

onclick="foo('thedate')"

or reference the element that was clicked and read the text

onclick="foo(this)"

and

function foo(elem) { 
    alert(elem.textContent); 
}

function foo1(str) {
   alert(str);  
}


function foo2(elem) {
   alert(elem.textContent);  
}
<table>
  <tbody>
    <tr>
      <td><a href="#" onclick="foo1('hello')">hello</a>
      </td>
    </tr>
    <tr>
      <td><a href="#" onclick="foo2(this)">hello</a>
      </td>
    </tr>
  </tbody>
</table>

</div>