[thelist] newbie help -- javascript return function value
Marc Cantwell
marc.cantwell at chinookmaterials.com
Mon Jan 5 02:33:05 CST 2009
I have a javascript function that creates a uniquely formatted
timestamp. I would like to load the value into a form text box either
on page load, or on click. Here is what I have so far, I have it set
to onclick, but when i set the parameter to the onclick to be for the
function, I don't get the value of the function, it runs the function
as a reference and opens up a new window with the value. Any help
would be great!
script
-----------
<script type="text/javascript">
function rfino ()
{
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
var hours = currentTime.getHours()
var minutes = currentTime.getMinutes()
var seconds = currentTime.getSeconds()
var milliseconds = currentTime.getMilliseconds()
document.write("RFI-" + month + day + year + hours + minutes + seconds
+ milliseconds)
}
</script>
--------------
Form Field (don't mind the code its an embed google spreadsheet form)
---------------
<div class="errorbox-good">
<div class="ss-form-entry"><label for="entry_22" class="ss-q-
title">RFI # :
<span class="ss-required-asterisk">*</span></label>
<label for="entry_22" class="ss-q-help"></label>
<input type="text" name="entry.22.single" value="" class="ss-q-short"
id="entry_22" onclick="this.value=rfino;" />
</div>
</div>
Marc Cantwell
Chinook Materials Inc
9125 SW Ridder Road, Suite B
Wilsonville, Oregon 97070-9626
Direct: 971.252.4735
Fax: 503.210.6265
www.chinookmaterials.com
-----------------------------------------------
Disclaimer - Chinook Materials, Inc.
This message (including any attachments) is intended only for the use
of the individual or entity to which it is addressed and may contain
information that is non-public, proprietary, privileged, confidential,
and exempt from disclosure under applicable law. If you are not the
intended recipient, you are hereby notified that any use,
distribution, or copying of this communication is strictly prohibited.
Although steps have been taken to check for viruses, the recipient(s)
should also check to ensure messages are virus free.
More information about the thelist
mailing list