鍍金池/ 問(wèn)答/HTML/ table中單選radio的運(yùn)用

table中單選radio的運(yùn)用

多行的table中每一行tr中有一個(gè)radio,但是這樣實(shí)現(xiàn)不了單選,并且radio項(xiàng)一直處于選中狀態(tài),對(duì)于這種現(xiàn)象,有沒(méi)有方法解決?

回答
編輯回答
影魅

可以實(shí)現(xiàn)的

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <table>
        <tbody>
            <tr>
                <td><input type="radio" name="test" id=""></td>
            </tr>
            <tr>
                <td><input type="radio" name="test" id=""></td>
            </tr>
            <tr>
                <td><input type="radio" name="test" id=""></td>
            </tr>
            <tr>
                <td><input type="radio" name="test" id=""></td>
            </tr>
            <tr>
                <td><input type="radio" name="test" id=""></td>
            </tr>
        </tbody>
    </table>
</body>
</html>

用name控制radio組

2018年1月8日 23:35