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 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Apr 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How do I perform a time check against the value of the combo option?

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    </head>
    
    <body>
    <form name="doublecombo">
      <p>
    <select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
      <option>Show 1</option>
      <option>Show 2</option>
    </select>    
    <select name="stage2" size="1">
    <option value="June 9 @ 8 PM">June 9 @ 8 PM</option>
    <option value="June 10 @ 8 PM">June 10 @ 8 PM</option>
    </select>
      <input type="button" name="test" value="Go!"
    onClick="go()">
    </p>
      <script>
    <!--
    
    /*
    Double Combo Script Credit
    By JavaScript Kit (www.javascriptkit.com)
    Over 200+ free JavaScripts here!
    */
    
    var groups=document.doublecombo.example.options.length
    var group=new Array(groups)
    for (i=0; i<groups; i++)
    group[i]=new Array()
    
    group[0][0]=new Option("June 9 @ 8 PM","June 9 @ 8 PM")
    group[0][1]=new Option("June 10 @ 8 PM","June 10 @ 8 PM")
    
    group[1][0]=new Option("June 22 @ 8 PM","June 22 @ 8 PM")
    group[1][1]=new Option("June 23 @ 8 PM","June 23 @ 8 PM")
    
    var temp=document.doublecombo.stage2
    
    function redirect(x){
    for (m=temp.options.length-1;m>0;m--)
    temp.options[m]=null
    for (i=0;i<group[x].length;i++){
    temp.options[i]=new Option(group[x][i].text,group[x][i].value)
    }
    temp.options[0].selected=true
    }
    
    function go(){
    location=temp.options[temp.selectedIndex].value
    }
    //-->
    </script>
    
    </form>
    </body>
    </html>
    My questions is:

    How do I perform a time check against the value of the combo option?

    Say if I select Show 1, June 9 @ 8 pm,

    If current time of the selected option is before (June 9, 9am) then
    go to page A
    Else
    go to page B.

    Please help. :)

    p/s - I copied the code from somewhere, hence you will see some irrelevant coding. :cool:
    Last edited by janicekoh; 04-19-2005 at 08:40 PM.


 

Posting Permissions

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