PDA

View Full Version : can i have Jscripts inside an input tag?



newdude2
Dec 6th, 2002, 09:21 AM
I managed to get my hands on some code to get the current date and time and i have placed this code in the header of my page,


Mins = Stamp.getMinutes();
if (Mins < 10) {
Mins = "0" + Mins;
}
//document.write('<font size="2" face="Arial"><B>' + Hours + ":" + Mins + Time + '</B></font>');


however, I am having the greatest problem putting this value in my input field within the body of my page


<td bgcolor="#EFF7DE" ><font class="medium_bold">Time Received</font></td>

<td class="medium"><input type="text" class="text_box" size="44" name="recvt" id="recvt" value="Hours" ></td>


I would appreciate any suggestions on how to accomplish this.

joh6nn
Dec 6th, 2002, 09:26 AM
Please don't post the same question twice.



the easiest way for you do to this, would be to take the code out of the head of your page, and do it like this:

<td bgcolor="#EFF7DE" ><font class="medium_bold">Time Received</font></td>
<script>
Mins = Stamp.getMinutes();
if (Mins < 10) {
Mins = "0" + Mins;
}
document.write('<td class="medium"><input type="text" class="text_box" size="44" name="recvt" id="recvt" value="' + Hours + ':' + Mins + Time +'"></td>');
</script>

newdude2
Dec 6th, 2002, 10:11 AM
Sorry about the double posting, and thanks for the solution.