日期:2014-05-16  浏览次数:20390 次

用JQuery找到最大值和最小值
在一个表格中找到最大值和最小值,请帮忙!!!!!

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<script type="text/javascript" src="JQuery/jquery-1.10.1.js"></script>

<script type="text/javascript">
$(document).ready(function() {
        $(".red_one",this).each(function() {
            var num = parseInt(this.innerHTML);
alert(num);
        });
    });
</script>
</head>

<body>

<table width="500" border="1" cellspacing="0" cellpadding="0">
  <tr>
    <td class="red_one">01</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td class="red_one">04</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td class="red_one">09</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>
jQuery JavaScript