faqts : Computers : Programming : Languages : JavaScript : Forms

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

0 of 3 people (0%) answered Yes
Recently 0 of 3 people (0%) answered Yes

Entry

How do I populate 1/1/2021 into field #1 if the user put 12/31/2000 in field #1?

Aug 11th, 2006 15:58
David Alden, Wendy Simmons,


<html>
<script type="text/javascript" language="javascript">
	function insertLineBreak(textInput){
		if(textInput.value == "12/31/2000")
			textInput.value="1/1/2001";
	}
</script>
	<form name="thisForm">
		<!-- call the onchange and the onkeyup events so that 
if a calendar program is used to enter the text or if the user types 
the text in the input field -->
		<input type="text" onchange="insertLineBreak(this)" 
onkeyup="insertLineBreak(this)" name="thisText">
	</form>
</html>