...

View Full Version : How do I perform a time check against the value of the combo option?



janicekoh
04-19-2005, 08:38 PM
<!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:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum