Time Different

winsonlee
06-20-2002, 10:28 AM
I have two drop down menu using html.

<code>

<select id="timein" name="timeins">
<option value="800" selected>8.00</option>
<option value="830">8.30</option>
<option value="900">9.00</option>
</select>


<select id="timeout" name="timeouts">
<option value="800" selected>8.00</option>
<option value="830">8.30</option>
<option value="900">9.00</option>
</select>

</code>

After selecting both the date i would like to display the difference of the time instantly. For your information i am using ASP. Is there anyway to do that ??? If there is, can anyone guide me to the answer ???

ChiefRedBull
06-20-2002, 01:45 PM
You don't need ASP - since ASP is processed on the server, it would be no good anyway. Your page can be generated via ASP, and you could use VBS to work out the time difference (you could also use JS).
How do you want to display the time? Text on the page, or in a textbox?
Here's some sample code...
<SCRIPT LANGUAGE=VBSCRIPT>

Sub timeout_onclick()

MsgBox CDate(timeout.text) - CDate(timein.text)

End Sub

</SCRIPT>
That *should* work, or at least should give you a good idea of where you're going next.... :)

winsonlee
06-28-2002, 06:49 AM
But from the drop down menu, how i can call the function from the sub ????

winsonlee
06-28-2002, 06:50 AM
For your information, i would like to display it in the text on the page.

Thinker
06-28-2002, 08:37 AM
I don't think these are drop-down menus. They are like VB combo
boxes and are usually part of a form (they have to be in a form in
netscape, but can be outside a form in IE). Since there is no easy
way to tell when both have been selected, you would have to use
a button (most likely a submit button on the form) to have the
user click when they have selected both. There is an onchange
event for the Select element, but once again, how can you tell
when it fires if the other Select element has already been done?

Robby
06-28-2002, 10:35 AM
I've used the onchange event with a select element, it works.

Thinker
06-28-2002, 10:59 AM
I didn't mean to say it didn't work, I mean there are two select
elements, and the value desired is a subtraction of one from the
other, so if the onchange fires from the first one, you don't know
if the second one has already been set. Maybe some variables
could be set in the sub, and if both are set display the difference?

winsonlee
06-28-2002, 11:00 AM
Can you show how you make the onchange even with a select button work ?? from onchange, how i can call the vbscript ??? I am a vbscript newbie. I hope that you can provide an example on how i can archieve that .



<SCRIPT LANGUAGE=VBSCRIPT>

Sub timeout_onclick()

MsgBox CDate(timeout.text) - CDate(timein.text)

End Sub

</SCRIPT>

Robby
06-28-2002, 11:11 AM
Sorry Thinker, I miss-read. "There is an onchange event" I read no , I'm getting old don't know.

Thinker
06-28-2002, 11:23 AM
Something like...
<select id="timein" name="timeins" onChange="timeout()">

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum