<%
    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" >日期
                </font></th>
        </tr>
    </div>
<form>我想在红色的日期处显示上面bdgintime的值.怎么处理呢,

解决方案 »

  1.   

    是点击查询以后么?
    在<input type="button" name="to_select" id="to_select" value="查  询"/>标签里加入onclick事件,
    <input type="button" name="to_select" id="to_select" value="查  询" onclikc="function(){document.getElementByTagName('font').get(0).innerHtml=''+document.getElementById('begintime').value+''}"/>
      

  2.   

    <script type="text/javascript">
    function setDateValue(){
    var dateHtml = ''+ document.getElementById('begintime').value+'';
    document.getElementByTagName('font').get(0).innerHtml = dateHtml;
    }
    <input type="button" name="to_select" id="to_select" value="查 询" onclick="setDateValue();" />
    抱歉,,刚才发的出了点问题
      

  3.   

    document.getElementById 楼主都不知道?
      

  4.   

    楼主多去看下基础知识吧,向楼主推荐一个网站:http://www.w3school.com.cn/ 里面有基础的js教程,还有其他的一些基础教程,我就是从上面慢慢学习的,呵呵,希望对楼主有所帮助!