+ -
当前位置:首页 → 问答吧 → 如何让一个输入框<input>默认显示当前时间?

如何让一个输入框<input>默认显示当前时间?

时间:2003-05-22

来源:互联网

<xsl:element name="input">
                                                        <xsl:attribute name="type">text</xsl:attribute>                <xsl:attribute name="name"><xsl:value-of select="field_name"/></xsl:attribute>                                <xsl:attribute name="class">flat_u</xsl:attribute>                <xsl:attribute name="value"></xsl:attribute>

</xsl:element>
怎么样才能使它显示当前时间?而且也可以允许输入

我在a.js中定义:
function getCurrentTime(){
        a=new Date();
        s=a.getHours() + ":" + a.getMinutes() + ":" + a.getSeconds();
        document.write(s);       
}

然后在XSL中用:
<xsl:attribute name="value">javascript:getCurrentTime()</xsl:attribute>
发现没起到效果

大家给点思路

作者: debug   发布时间: 2003-05-22

<xsl:element name="input">
                                                        <xsl:attribute name="type">text</xsl:attribute>                <xsl:attribute name="name"><xsl:value-of select="field_name"/></xsl:attribute>                                <xsl:attribute name="class">flat_u</xsl:attribute>                <xsl:attribute name="value"><xsl:eval>var t=new Date();...</xsl:eval></xsl:attribute>

作者: imafool   发布时间: 2003-05-22