Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Functionality 1

Status
Not open for further replies.

tyleri

Programmer
Jan 2, 2001
173
US
Ok I need help- I have a form - and i am setting up an automatic text paging thing with Metrocall. Everything works fine, except I am trying to insert the current date & time + a text message immediately following the date and time inside of an input form.
Here is my code:

-------------------------------------------
<head><script>
function showit(){
var current = Date();
document.the_form.message.value = current;
}
</script></head>

<BODY ONLOAD=&quot;showit(); document.the_form.submit()&quot; ...>

<TEXTAREA NAME=message ROWS=3 COLS=55 WRAP=virtual>
User Down! Check Heat ASAP!
</TEXTAREA>

------------------------------------------------

ok - what it currently displays is just the date & time. I can't seem to get it to show the &quot;user down&quot; text as well. Does anyone know how I can manipulate my code to display BOTH the date + the text in the text area?

I am an idiot so if you know the answer I'll need special instructions! ;-)
 
OK. If you want to put the date first, you can do this:

function showit(){
var current = Date();
var old = document.the_form.message.value;
document.the_form.message.value = current+old;
}

Otherwise to put the date last, there are 2 ways. 1:
function showit(){
var current = Date();
var old = document.the_form.message.value;
document.the_form.message.value = old+current;
}
2:
function showit(){
var current = Date();
document.the_form.message.value += current;
}

Have fun inserting!
Rick If I have helped you just click the first link below to let me know :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top