www.webdeveloper.com
Results 1 to 2 of 2

Thread: how to display days , hours and minutes in my page which is comming from java script

Hybrid View

  1. #1
    Join Date
    Mar 2013
    Posts
    5

    Talking how to display days , hours and minutes in my page which is comming from java script

    hi
    i got little problem. can you give me suggestion.
    Code:
    <script type = "text/javascript">
    var hours = document.getElementById("totalTime").value;
    var days = Math.floor(hours/24);
    var hrs = Math.floor(hours%24);
    var decimal = hours - Math.floor(hours);
    var minutes = Math.round(decimal * 60);
    
    document.getElementById("actualDays").value= +days+" Day(s) "+hrs+" Hour(s) "+minutes+" Minute(s)";
    
    </script>
    based on above script i am able to display my values in text box like below.
    Code:
    <input  name="actualDays"  id="actualDays" value="" size="30"  readonly="yes"/>


    but i need to display these values as a text values (using lable or span....).
    can you help me for this

  2. #2
    Join Date
    Feb 2013
    Posts
    46
    Move the id "actualDays" to a span/label/ or what you want, and use innerHTML instead of 'value' to change the text/html of that element.
    http://jsfiddle.net/3A6fJ/

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles