I want to pass information to a function based on the HTML input box that was clicked. Then I want to take that information and use it in a function to pass information back to the HTML input box that this came from. I am using a double click as the event. The doubleclick works in bringing the information to the function, but I don’t know how to get the function to place the info back into the input box. Here is the code:
<SCRIPT LANGUAGE=”JavaScript”>
<!– Start Hiding the Script
// JavaScript Function for inserting current date into Invoice Date
function NewBillDate(InputName) {
var date = new Date();
var d = date.getDate();
var day = (d < 10) ? ‘0’ + d : d;
var m = date.getMonth() + 1;
var month = (m < 10) ? ‘0’ + m : m;
var yy = date.getYear();
var year = (yy < 100) ? yy + 1900 : yy; // Why (yy < 1000) ?? // I changed it to (yy < 100)
var finishedyear = (month + “/” + day + “/” + year);
// Bad Code is as follows
document.form1.InputName.value = finishedyear;
// End of Bad Code
}
–>
</SCRIPT>
<input type=”text” name=”BillDate” size=”10″ ID=”Text3″ onDblClick=”NewBillDate(‘BillDate’);”>