Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

How to add a script to the ActiveX Calendar Control in FrontPage 2002


View products that this article applies to.

This article was previously published under Q299691
For a Microsoft FrontPage 97 version of this article, see 164620 (http://support.microsoft.com/kb/164620/ ) .

For a Microsoft FrontPage 2000 version of this article, see 205686 (http://support.microsoft.com/kb/205686/EN-US/ ) .
For a Microsoft FrontPage 97 version of this article, see 164620 (http://support.microsoft.com/kb/164620/ ) .

↑ Back to the top


Summary

The ActiveX Calendar Control provides a way of displaying calendar-related events on a Web page. ActiveX Controls can be combined to add greater functionality to your Web pages than is possible with a single control. This article explains how to add a script to an ActiveX Calendar Control.

NOTE: Microsoft Office XP installs the ActiveX Calendar Control. If you do not have Microsoft Office XP installed, the Calendar Control may not appear in the Choose a control list. The Calendar Control can be found in the Microsoft Office XP Installation Options under the following path:
   Microsoft Office
      Microsoft Access for Windows
         Calendar Control
				
NOTE: This article makes use of custom DHTML and ActiveX Controls that may not be available in all browsers. For more information about compatibility with other browsers, click Microsoft FrontPage Help on the Help menu, type compatibility in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

↑ Back to the top


More information

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. NOTE: You may receive an error message if you copy the examples directly from this article and paste them into FrontPage. The angle brackets (< and >) may appear as escaped HTML code (< and >). To work around this behavior, paste the script into a blank Notepad document, and then copy it from Notepad before you paste it into FrontPage.

Code Sample

In a new page in FrontPage, follow these steps to use the Calendar Control to populate a text box in an HTML form:
  1. Insert a form on the page.

    To insert a form on your new page, follow these steps:
    1. On the Insert menu, point to Form and then click Textbox.
    2. Double-click the text box. In the Text Box Properties dialog box, change the Name box to txtDate.
    3. Click OK to close the Text Box Properties dialog box.
    4. Right-click the form, and then select Form Properties.
    5. Type MyForm in the Form name field.
    6. Click OK to close the Form Properties dialog box.
  2. Insert the Calendar Control on the page.

    To insert the Calendar control on your page, follow these steps:
    1. On the Insert menu, click Web Component.
    2. In the Insert Web Component dialog box, click Advanced Controls in the Component type list, and then click ActiveX Control. Click Next.
    3. In the Choose a control list, click Calendar Control 10.0, and then click Finish.
  3. Add a script to the Calendar Control.

    To add a script to the Calendar Control, follow these steps:
    1. Click the HTML tab.
    2. Insert the following code under the <BODY> tag:
      <SCRIPT LANGUAGE="vbscript">
      <!--
        Sub Calendar1_Click()
          MyForm.txtDate.value = Calendar1.Value
        End Sub
      -->
      </SCRIPT>
      						
When you preview your Web page, as you click dates in the calendar, the text box will be populated with the date selected.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

↑ Back to the top


References


For more information about Microsoft Visual Basic Scripting, visit the following Microsoft Web site:

↑ Back to the top


Keywords: KB299691, kbhowto, kbprogramming, kbautomation

↑ Back to the top

Article Info
Article ID : 299691
Revision : 6
Created on : 8/8/2007
Published on : 8/8/2007
Exists online : False
Views : 307