SoFunction
Updated on 2025-03-01

Use javascript to control the effective time and display the time that will expire


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:///TR/xhtml1/DTD/">
<html xmlns="http:///1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Unt titled document</title>
<style type="text/css">
#lastdate{ color:#FF9900; font-style:normal;}
</style>

</head>
<body>
<div class="f-c">
          <select name="period" class="buyConQc select150">
<option value="0">In one day</option>
<option value="1">within two days</option>
<option value="2">within three days</option>
<option value="3">within four days</option>

          </select>
<span class="postAction">After   <em >2012-9-28</em> , it will expire</span>

        </div>
 <script type="text/javascript">

    ('date_sel').onchange = function(){
        var time = new Date();
        var pre_year = ();
        var pre_month = ();
        var pre_day = ();
        var sel_day = parseInt(('date_sel').value);
        switch(sel_day){
            case 0: pre_day +=1;break;
            case 1: pre_day +=2;break;
            case 2: pre_day +=3;break;
            case 3: pre_day +=4;break;
            default:pre_day +=1;break;
}
    var endtime = new Date(pre_year, pre_month, pre_day);
    ('lastdate').innerHTML = ()+"-"+(()+1)+"-"+();
};
</script>
</body>
</html>