JavaScript Instance Tutorial (19) using HoTMetaL (1)

Source: Internet
Author: User
Tags add format
javascript| Tutorial

HoTMetaL PRO 6.0 is a powerful and easy-to-use Web site editing and publishing tool. In this tutorial, we use JavaScript in HoTMetaL. In HoTMetaL, JavaScript support is based on HoTMetaL to provide you with a wealth of resources and objects. It contains a few new objects, such as objects that access the DOM. In addition, HoTMetaL supports some ActiveX controls. These controls, along with Windows scripting support, make hotmetal a powerful development environment for JavaScript designers.

In this tutorial you will be able to learn:

How to add a connection macro for the button;

How to add a button to the menu bar;

What resources are appropriate for scripting;

How to write a document format script;

How to write a script to check the date of the last modification;

How to write a save module script;

How to identify all the predefined macros;

OK, the next page starts with a step-by-go introduction.

Using JavaScript in HoTMetaL

1. How to add a connection macro for the button:

HoTMetaL can support scripts through macros. Macros can be invoked using toolbar buttons and other means, which we'll cover later in the tutorial. All hotmetal macros should be stored in a single file, such as HOTMETAL.MCR. This file is in the macro folder Softquad\hotmetal PRO 6.0. If you have installed HoTMetaL Pro 6.0 under the default directory C disk, then your macro file is in C:\Program files\softquad\hotmetal Pro 6.0\MACROS\HOTMETAL.MCR. Note here that the file extension is. MCR, but it cannot be edited in a hotmetal environment. You can use any text editor to edit it, such as Notepad, and so on. HoTMetaL PRO 6.0 installs approximately 20 predefined macros for the user. You can browse them by HOTMETL.MCR files. You can also find them by selecting macros (macros) on the Tools menu.

One way to allow macros is to create a toolbar button and make it macro connected. Clicking the button triggers the execution of the script defined in the macro. When you select the toolbar from the Attempt menu, you will see a dialog box like Figure 1.



(Figure 1)

The first label (Toolbars, toolbar) in the diagram allows you to add, remove, and manipulate the toolbar. Because we do not want to change any of the toolbar, so this label is now temporarily not used by us. Click on the button (Buttons) tab and select "Application Macros" from the category bar to note that the new Text dialog box appears on the right, as shown in Figure 2:



(Figure 2)

The first macro in the list box is "Apply Layout to Document." Let's install a button for it to the Standard toolbar.
First, select a picture for the button. When you click the Select Picture button, you will be able to select a picture from many palette. Once you click on one of these, you will get a window like Figure 3:



(Figure 3)

In this example, select a picture of a yellow smiley face, as shown in Figure 4:



(Figure 4)

Now drag the smiley icon to the Standard toolbar, or some other toolbar. Closes the Toolbar and Menu customization dialog box. This is the new button that will appear in the Standard toolbar or any other toolbar you choose. The following is an expanded Standard toolbar view, as shown in Figure 5:



(Figure 5)

Now let's try this macro. First open an HTML file, for the sake of simplicity, select the about.htm in D:\Program files\softquad\hotmetal PRO 6.0\tutorial\samples\lesson1. Click the HoTMetaL PRO 6.0 ' s HTML Source View tab, and then move to the right with space padding in front of them, then click the Smiley Face button. This is the source program that will automatically change to reflect the layout definition described in the custom dialog box. Then you will see the source code return to its original layout format.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.