|
-
Mar 7th, 2001, 09:08 AM
#1
Thread Starter
Addicted Member
Hi guys
I have a form on a web page. I am creating a web page to log calls that come in. Basically what I want to do is press the button and the time and date will apprear in the text box.
Thanks a lot for your help
JK
Code:
<Form>
<input type="submit" name="Call Received" value="Call Received">
<input type="text"name="time">
</Form>
-
Mar 7th, 2001, 09:31 AM
#2
Retired VBF Adm1nistrator
This should do the trick :
Code:
<form name="calc" action="">
<input type="text" name="time" size="20" tabindex="1">
<input type="button" value="Calculate" name="cmdDoTime" tabindex="3">
</form>
<SCRIPT LANGUAGE="VBScript">
Sub cmdDoTime_onClick()
Document.calc.time.Value = Time()
End Sub
</script>
- jamie
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Mar 7th, 2001, 09:49 AM
#3
Javascript
You can also use Javascript.
Code:
<script language=javascript>
<!--
function Button_onclick() {
time.value = new Date();
}
//-->
</script>
And use this Input tag.
Code:
<INPUT id=Button type=button value=Button name=Button language=javascript onclick="return Button_onclick()">
-
Mar 7th, 2001, 10:09 AM
#4
Thread Starter
Addicted Member
Hi guys
Thanks a lot for the help. kayoca I can't seem to get yours working for some reason. I keep getting a time is not an object message. I've tried a few different variations. Just out of curiosity, any ideas what wrong.
Thanks a lot guys
I really appreciate the help
plenderj that works great thanks!
-
Mar 7th, 2001, 11:26 AM
#5
If you just use new Date() on a variable you wil get for example Wed Mar 7 16:57:43 UTC+0100 2001
Code:
var TimeStamp = new Date();
But if you just want the time values use this code.
Code:
// Getting all the time values
var MyHour = TimeStamp.getHours();
var MyMinute = TimeStamp.getMinutes();
var MySeconds = TimeStamp.getSeconds();
// Placing the values in a time variable
var MyTime = MyHour +":"+ MyMinute +":"+ MySeconds;
-
Mar 7th, 2001, 11:55 AM
#6
Thread Starter
Addicted Member
Thanks a lot for the help. I really prefer using Javascript.
Cheers
JK
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|