<!DOCTYPE html>
<html>
<head>
<style>
table {
border-collapse: collapse;
}
table, td, th {
border: 1px solid black;
}
</style>
</head>
<body>
<h2>Let the borders collapse:</h2>
<table>
<tr>
<th><input onclick="myFunction()" type="radio" name="gender" id="gender_Male" value="Male" />male
<input onclick="myFunction()" type="radio" name="gender" id="gender_Female" value="Female" />nữ
<input onclick="myFunction()" type="radio" name="colors" id="2">Blue2</th>
<th><input onclick="myFunction()" type="radio" name="colors" id="3">Blue3
<input onclick="myFunction()" type="radio" name="colors" id="4">Blue4
<input onclick="myFunction()" type="radio" name="colors" id="5">Blue5</th>
</tr>
<tr>
<td>Peter</td>
<td><input onclick="myFunction()" type="radio" name="colors" id="6">Blue 6</td>
</tr>
<tr>
<td><input onclick="myFunction()" type="radio" name="colors" id="id=7">Blue 7</td>
<td><input onclick="myFunction()" type="radio" name="colors" id="id=8">Blue 8</td>
</tr>
</table>
<script>
function myFunction() {
var radios = document.getElementsByTagName('input');
var value;
for (var i = 0; i < radios.length; i++) {
if (radios[i].type === 'radio' && radios[i].checked) {
// get value, set checked flag or do whatever you need to
value = radios[i].value;
a= i+1;
b =radios[i].id +" thu tu" +a;
var myWindow = window.open("", "MsgWindow", "width=200, height=100");
myWindow.document.write(b);
}
}
}
</script>
</body>
</html>
<html>
<head>
<style>
table {
border-collapse: collapse;
}
table, td, th {
border: 1px solid black;
}
</style>
</head>
<body>
<h2>Let the borders collapse:</h2>
<table>
<tr>
<th><input onclick="myFunction()" type="radio" name="gender" id="gender_Male" value="Male" />male
<input onclick="myFunction()" type="radio" name="gender" id="gender_Female" value="Female" />nữ
<input onclick="myFunction()" type="radio" name="colors" id="2">Blue2</th>
<th><input onclick="myFunction()" type="radio" name="colors" id="3">Blue3
<input onclick="myFunction()" type="radio" name="colors" id="4">Blue4
<input onclick="myFunction()" type="radio" name="colors" id="5">Blue5</th>
</tr>
<tr>
<td>Peter</td>
<td><input onclick="myFunction()" type="radio" name="colors" id="6">Blue 6</td>
</tr>
<tr>
<td><input onclick="myFunction()" type="radio" name="colors" id="id=7">Blue 7</td>
<td><input onclick="myFunction()" type="radio" name="colors" id="id=8">Blue 8</td>
</tr>
</table>
<script>
function myFunction() {
var radios = document.getElementsByTagName('input');
var value;
for (var i = 0; i < radios.length; i++) {
if (radios[i].type === 'radio' && radios[i].checked) {
// get value, set checked flag or do whatever you need to
value = radios[i].value;
a= i+1;
b =radios[i].id +" thu tu" +a;
var myWindow = window.open("", "MsgWindow", "width=200, height=100");
myWindow.document.write(b);
}
}
}
</script>
</body>
</html>
Đăng nhận xét