JavaScript对input的内容做样式后:form reset 造成的bug

    技术2022-05-20  74

    用JavaScript实现了databox

    input的value是unix时间戳,通过JavaScript,将该时间戳显示为:****-**-** **:** PM

    但是form reset后,丑陋的时间戳有回到了input里面。

     

    分析:主要是input的defaultValue造成的

     

    解决:修改input的value值时,同步修改input的defaultValue值

     

    问题:似乎之有Firefox支持这种解决方法

     

    分析:I wanted to see what the HTML standard has to say about it, but apparently, the defaultValue attribute is a non-standard extension, supported by both IE and FF.


    最新回复(0)