php javascript クリックすると入力領域が開く php内でwhile

| コメント(0)

$i = 1;
    while($rows = mysql_fetch_array($results)) {

中略

@$tempHtmls .= "<td>";
        @$tempHtmls .= "<div id=\"divtext".$i."\">".$Memo."</div>";
        @$tempHtmls .= "<textarea name=\"memo\" id=\"areatext".$i."\" style=\"display:none;\" cols=30 rows=8>".$Memo."</textarea>";
        @$tempHtmls .= "<script type=\"text/javascript\">";
                   @$tempHtmls .= "$('#divtext".$i."').click(function() {";
                   @$tempHtmls .= "$('#divtext".$i."').css('display', 'none');";
                   @$tempHtmls .= "$('#areatext".$i."')";
                          @$tempHtmls .= ".val($('#divtext".$i."').text())";
                          @$tempHtmls .= ".css('display', '')";
                          @$tempHtmls .= ".focus();";
                   @$tempHtmls .= "});";
                   @$tempHtmls .= "$('#areatext".$i."').blur(function() {";
                   @$tempHtmls .= "$('#areatext".$i."').css('display', 'none');";
                   @$tempHtmls .= "$('#divtext".$i."')";
                   @$tempHtmls .= ".text($('#areatext".$i."').val())";
                   @$tempHtmls .= ".css('display', '');";
                   @$tempHtmls .= "});";
              @$tempHtmls .= "</script>";
        @$tempHtmls .= "<td>";

$i++;

コメントする