<input id="a" name="a" type="text" value="" onclick="showTimeWinProxy(this.name)"/>
现在有 input语句  令其默认为系统的当前日期+00:00:00   如何实现 ? 谢谢各位大侠! 触发onclick  日期和时间可选

解决方案 »

  1.   

    jsp中你可以这样:
    <%
    Date nowTime=new Date();
    SimpleDateFormat matter=new SimpleDateFormat("yy/MM/dd"); 
    String time = matter.format(nowTime)+" 00:00:00";
    %>
    <input id="a" name="a" type="text" value="<%=time%>" onclick="showTimeWinProxy(this.name)"/>
      

  2.   

    可以这样写:
    select convert(字段,varchar(20),111)from 表名
    101-111默认的都是显示时间的格式。   
      

  3.   


    <input id="aa" name="a" type="text" value="" onclick="showTimeWinProxy(this.name)"/>
    <script language="javascript">
        var d = new Date();
        var obj = document.getElementById("aa");
        date =d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate()+" 00:00:00";
        obj.value = date;
    </script>
      

  4.   

    什么意思?是不是要在文本框里面显示时间?<%@ page language="java" contentType="text/html; charset=GBK"
        pageEncoding="GBK"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=GBK">
    <title>利用javascript显示当前时间</title>
    </head>
    <script type="text/javascript"><!--
    function   setTime()   {   
    var NowTime=new Date();
    var hours = NowTime.getHours();
    var minutes = NowTime.getMinutes();
    var seconds = NowTime.getSeconds();
    var timeValue = "" +((hours >= 12) ? "下午 " : "上午 " );
    timeValue += ((hours >12) ? hours -12 :hours);
    timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
    timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
      
      var   Dtime  = 
                  NowTime.getYear()   +   "年"   +     
                  (NowTime.getMonth()+1)   +   "月"   +     //getMonth()取得的数字是比当前月份小1
                  NowTime.getDate()   +   "号\n"   +     
                      timeValue;   
      txtDate.value=Dtime;   
      setTimeout('setTime()',1000);     
    }
    </script>
    <body onload=setTime()>
      <input   type="text"  name="txtDate"  size="25"  style="border-left:0px;border-top:0px;border-right:0px;border-bottom:0px  " >   
    </body>
    </html>
      

  5.   


    <input id="aa" name="a" type="text" value="" onclick="showTimeWinProxy(this.name)"/>
    <script language="javascript">
        var d = new Date();
        var obj = document.getElementById("aa");
        date =d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate()+" 00:00:00";
        obj.value = date;
    </script>