0
아래의 코드에서 먼저 드롭 다운에 자바 스크립트 코드를 사용하고 첫 번째 행만 업데이트하고 나머지는 updated.And가 아니며 다음에 모두 HTML 코드를 사용했습니다 행을 업데이 트 pls 아무도이 문제를 해결하기 위해 도움이됩니다. 내가 html에서 js로 변경된 이유는 자동차 년 동안입니다.드롭 다운의 자바 스크립트 값이 업데이트되지 않습니다
<script type="text/javascript">
function autoYear() {
var time = new Date();
var year = time.getYear();
if (year < 1900) {
year = year + 1900;
}
var date = year - 1; /*change the '25' to the number of years in the past you want to show */
var future = year + 10; /*change the '10' to the number of years in the future you want to show */
document.writeln ("<form><select id='year_<?php echo $row->id ?>' name='year_<?php echo $row->id ?>' ><option value=\"\"><?php echo $row->year; ?>");
do {
date++;
if (date != <?php echo $row->year; ?>) {
document.write ("<option value=\"" +date+"\">" +date+ "");
}
}
while (date < future);
document.write ("</select></form>");
}
</script>
<script type="text/javascript">
autoYear();
</script>
모든 HTML을
<select class="inputmedium" name="year_<?php echo $row->id; ?>" id="year_<?php echo $row->id; ?>" value="<?php echo $row->year; ?>">
<?php for($s=0;$s<8;$s++)
{
if($row->year!=null and $row->year==$year_array[$s]){
echo "<option selected value='" .$year_array[$s]. "'>" .$year_array[$s]. "</option>";
}else{
echo "<option value='" .$year_array[$s]. "'>" .$year_array[$s]. "</option>";
}
} ?>
</select>
<?php
$year_array=array();
$year_array[0]="2013";
$year_array[1]="2014";
$year_array[2]="2015";
$year_array[3]="2016";
$year_array[4]="2017";
$year_array[5]="2018";
$year_array[6]="2019";
$year_array[7]="2020";
?>
에 문제가 첫 번째 행이 행을 나머지 업데이트되는 해결되지 없습니다 – user2935177