[PHP-users 11107] Re: インラインの処理で

Shigeru Matsumoto php-users@php.gr.jp
2002年10月26日 16:32:01 +0900


matsuです。
以下の場合は、正常に動作します。
----- inline.html -----
<html>
<head>
<title>123</title>
<script language="JavaScript">
<!--
/**** col はチェックを含むカラム数 ****/
 function setCheckAndColor(col)
 {
 num = window.event.srcElement.id;
 if(num == "" || num % col == 0)
 return;
 num = num - 0; // 数値にする。
  // チェックのidを計算する。
 id = (Math.ceil((num + 1) / col) - 1) * col;
 if(document.getElementById(id).checked)
 {
 document.getElementById(id).checked = false;
 // その行のチェック以外をペイントする。
 for(i = 1; i < col; i++)
 document.getElementById(i + id).style.backgroundColor =
"#B4EEB4";
 }
 else
 {
 document.getElementById(id).checked = true;
 for(i = 1; i < col; i++)
 document.getElementById(i + id).style.backgroundColor =
"#FFFF00";
 }
 }
 function setColor(obj, col)
 {
 id = obj.id;
 id = id - 0;
 if(obj.checked)
 {
 for(i = 1; i < col; i++)
 document.getElementById(i + id).style.backgroundColor =
"#FFFF00";
 }
 else
 {
 for(i = 1; i < col; i++)
 document.getElementById(i + id).style.backgroundColor =
"#B4EEB4";
 }
 }
//-->
</script>
<head>
<body style="margin-left:0px;margin-top:0px;margin-right:0px">
<form name="a">
<table border="1">
<script language="JavaScript">
<!--
 num = 0;
 for(i = 0; i < 20; i++)
 {
 document.write("<tr style='background-color:#B4EEB4'><td><input
type='checkbox' id='" + num + "' value='' onClick='setColor(this,
3)'></td>");
 num++;
 document.write("<td id='" + num + "' width='100' height='29'
onClick='setCheckAndColor(3)'>"+i+i+i+i+i+i+"</td>");
 num++;
 document.write("<td id='" + num + "' width='100' height='29'
onClick='setCheckAndColor(3)'>"+i+i+i+i+i+i+"</td></tr>");
 num++;
 }
//-->
</script>
</table>
</form>
</body>
</html>
違いがわかりません。
phpとは関係ないのでしょうか?

AltStyle によって変換されたページ (->オリジナル) /