Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Dec 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to display Time in Select-Option Selector

    How to display Time in Select-Option Selector ?

    To explain more clearly, i would like to give an example:

    When we open the Calendar in the Windows computer from bottom right hand corner of the computer screen.

    We get a window in which, we can see Date & Time Zone.

    Now the TIme function which is shown allows us to change the Hour, Minutes,Second onSelect of individual Field..?

    Thats what i am trying to implement using JSP?

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts

  • #3
    New to the CF scene
    Join Date
    Dec 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you for reply Philip, i have gone through those Examples , however i was able to only change the Hour of the Time displayed in the text box.

    Q1. I want to change the Hours, Minutes and Seconds onSelecting fields
    Q2. And Program it shows id=myspan has been passed to the script, I want to display the time in the text box, however its also showing me in Body?

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    Could you explain what is the point of what you are trying to do?

    The time is taken from the user's operating system. As such any arbitrary time can be displayed if there is any purpose in it. I can see why you might want to change the hour depending on the time-zone, but I find it hard to see the point of altering minutes/seconds.

  • #5
    New to the CF scene
    Join Date
    Dec 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry Philip, Couldn't reply over the weekend..

    We are implementing the time on a webpage, we thought to provide user friendly, so that User can easily modify the time on Select of, Hours, Minutes and Seconds and Click on Plus or Minus button to increas or decrease the same...

    Q. I tried to implement what the code shows in the above link, however the Time showing on a webpage body, i was unable to remove, Since myspan has been used inthe script..

    What we want is only to show the time in the text box and alter from there?

  • #6
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    I am afraid that I still do not see the point.

    But you can display the time (taken from the host clock) thus:-

    <body onload = "initClock()">
    <form name = "myform">
    <input type ="text" name = "clockDisplay" size = "6">
    </form>

    <script type = "text/javascript">

    function initClock() {
    var now = new Date();
    var hh = now.getHours();
    var mm = now.getMinutes();
    var ss = now.getSeconds();
    if (hh <10) {hh = "0" + hh}
    if (mm <10) {mm = "0" + mm}
    if (ss <10) {ss = "0" + ss}
    document.myform.clockDisplay.value = hh + ":" + mm + ":" + ss;
    }

    </script>

    But if the user is to alter this time (why??) you will need to check that the new time is valid (not 34:88:94 or whatever).


  •  

    Posting Permissions

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