Auto form fill in

A

A Webmaster

Does anyone know how to set up the form in frontpage so
that when say a user selcets a date in the form field
below it will automatically fill in the day in the day
field with out the user having to put in the day field
themselves.

Look forward to your suggestions

Many Thanks
 
J

Jim Buyens

-----Original Message-----
Does anyone know how to set up the form in frontpage so
that when say a user selcets a date in the form field
below it will automatically fill in the day in the day
field with out the user having to put in the day field
themselves.

Suppose you name the text boxes for the date and day
txtDate and txtDay. In that case, add the following
attribute to the <input> tag for txtDate:

onchange="setDay();"

and then add this script anywhere in your page.

<script>function setDay(){
dte = new Date(document.forms[0].txtDate.value);
daynr = dte.getDay();
if (isNaN(daynr)){
document.forms[0].txtDay.value = "";
}else{
document.forms[0].txtDay.value =
"SunMonTueWedThuFriSat".substring(daynr*3, (daynr*3)+3);
}
}
</script>


Jim Buyens
Microsoft FrontPage MVP
(e-mail address removed)
http://www.interlacken.com
Author of:
*------------------------------------------------------*
|\----------------------------------------------------/|
|| Microsoft Office FrontPage 2003 Inside Out ||
|| Microsoft FrontPage Version 2002 Inside Out ||
|| Web Database Development Step by Step .NET Edition ||
|| Troubleshooting Microsoft FrontPage 2002 ||
|| Faster Smarter Beginning Programming ||
|| (All from Microsoft Press) ||
|/----------------------------------------------------\|
*------------------------------------------------------*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top