드롭 다운 메뉴에서 연도를 선택하고 텍스트 상자 startDate
을 자동으로 채울 때마다 1 개의 드롭 다운 상자 [연도], 2 개의 텍스트 상자가 있습니다 [startDate, endDate]
, 01/01/+year
및 endDate
내지 12/31/+year
으로 설정하십시오. 아래에서 언급 한 스크립트는 Firefox에서는 잘 작동하지만 IE에서는 getElementById ('ff5'). 값이 작동하지 않습니다. 제안 사항은 무엇입니까?크로스 브라우저 문제 : document.getElementById(). 값이 IE에서는 작동하지 않지만 Firefox에서 작동합니다.
내 스크립트를
<script>
function autoPopulateDate(value, startDt,endDt){
document.getElementById(startDt).value='01/01/'+value;
document.getElementById(endDt).value='12/31/'+value;
}
</script>
HTML 코드 :
<tr>
<td>
<select onchange="autoPopulateDate(this.value,'ff5','ff6')" size="1" name="ff4" id="ff4"><option value="">-->select value<--</option><option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="ALL">ALL</option>
</select>
</td>
</tr>
<tr>
<td ><font class="rtabletext">Savings Start Date: </font></td>
<td >
<input type="text" value="" name="ff5" id="ff5" maxlength="50" size="10" class="text">
</td>
</tr>
<tr>
<td><font class="rtabletext">Savings End Date: </font></td>
<td>
<input type="text" value="" name="ff6" id="ff6" maxlength="50" size="10" class="text">
</td>
</tr>
네를 사용할 수 있지만 IE 브라우저 인 나는 지원해야한다. – Rachel
@Rachel IE (8)에서 저를 위해 작동합니다. –
IE7을 사용하고 있으며 다른 JavaScript 페이지가 없습니다.보고 도구에는 실제로이 기능이 필요합니다. – Rachel