日期:2014-05-16  浏览次数:20434 次

关于页面取值的问题
JScript code

<%
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.DATE, -1);
    SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
    String newTime = sf.format(cal.getTime());
%>
<form id="taizhytk" name="taizhytk" method="post" class="checkout" action="">
<div>
        <table>
            <tr>
                <td>
                    查询时间:
                    <input id="begintime" name="begintime" type="text" onclick="WebCalendar.start(this, 'yyyy-MM-dd')"
                           value="<%=newTime %>" maxlength="20" style="width:80px" readonly/>
                    <input type="button" name="to_select" id="to_select" value="查  询"/>
                </td>
            </tr>
        </table>
    </div>
    <div>
        <tr>
            <th nowrap="nowrap" colspan="7" width="90%" background="<c:url value="/images/head.gif"/>">
                <font color="bule" style="font-size: 13pt" >[color=#FF0000]日期[/color]
                </font></th>
        </tr>
    </div>
<form>


我想在红色的日期处显示上面bdgintime的值.怎么处理呢,

------解决方案--------------------
JScript code
<script type="text/javascript">
function setDateValue(){
var dateHtml = '[color=#FF0000]'+ document.getElementById('begintime').value+'[/color]';
document.getElementByTagName('font').get(0).innerHtml = dateHtml;
}
<input type="button" name="to_select" id="to_select" value="查 询" onclick="setDateValue();" />