0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Javascriptで縦横チェックボックスに一気にチェック付けるやつ

Last updated at Posted at 2013-10-30
<SCRIPT TYPE="text/javascript">
function BoxCheckedCircle(circle){
	var elements = document.getElementsByClassName(circle);
	for (i = 0; i < elements.length; i++) {
		elements[i].checked = true;
	}
}
function BoxCheckedCommu(commu){
	var elements = document.getElementsByClassName(commu);
	for (i = 0; i < elements.length; i++) {
		elements[i].checked = true;
	}
}
</SCRIPT>

<FORM NAME="form1">

<table border="1">
<tr>
<td></td>
<td></td>
<td>サークル1</td>
<td>サークル2</td>
<td>サークル3</td>
</tr>

<tr>
<td></td>
<td></td>
<td><INPUT TYPE="button" onClick="BoxCheckedCircle('circle_1');" VALUE="全て選択"></td>
<td><INPUT TYPE="button" onClick="BoxCheckedCircle('circle_2');" VALUE="全て選択"></td>
<td><INPUT TYPE="button" onClick="BoxCheckedCircle('circle_3');" VALUE="全て選択"></td>
</tr>

<tr>
<td>店舗1</td>
<td><INPUT TYPE="button" onClick="BoxCheckedCommu('commu_1');" VALUE="全て選択"></td>
<td><INPUT TYPE="checkbox" NAME="chk" VALUE="commu_1_circle_1" class="commu_1 circle_1"> </td>
<td><INPUT TYPE="checkbox" NAME="chk" VALUE="commu_1_circle_2" class="commu_1 circle_2"> </td>
<td><INPUT TYPE="checkbox" NAME="chk" VALUE="commu_1_circle_3" class="commu_1 circle_3"> </td>
</tr>

<tr>
<td>店舗2</td>
<td><INPUT TYPE="button" onClick="BoxCheckedCommu('commu_2');" VALUE="全て選択"></td>
<td><INPUT TYPE="checkbox" NAME="chk" VALUE="commu_2_circle_1" class="commu_2 circle_1"> </td>
<td><INPUT TYPE="checkbox" NAME="chk" VALUE="commu_2_circle_2" class="commu_2 circle_2"> </td>
<td><INPUT TYPE="checkbox" NAME="chk" VALUE="commu_2_circle_3" class="commu_2 circle_3"> </td>
</tr>

<tr>
<td>店舗3</td>
<td><INPUT TYPE="button" onClick="BoxCheckedCommu('commu_3');" VALUE="全て選択"></td>
<td><INPUT TYPE="checkbox" NAME="chk" VALUE="commu_3_circle_1" class="commu_3 circle_1"> </td>
<td><INPUT TYPE="checkbox" NAME="chk" VALUE="commu_3_circle_2" class="commu_3 circle_2"> </td>
<td><INPUT TYPE="checkbox" NAME="chk" VALUE="commu_3_circle_3" class="commu_3 circle_3"> </td>
</tr>

</FORM>
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?