Summary of technologies for making dynamic results on the home page

Source: Internet
Author: User

Today, the home page is a new multimedia dynamic home page that truly integrates images, animations, sounds, and videos, and has a good interactive interface. Many of the dynamic effects that were never imagined in the past can now be easily achieved through these new technologies. This article describes the implementation of some dynamic effects in the web page preparation process. I hope you can activate your web page.

I. Menu Technology

The menu technology is usually combined with the frame. Generally, the frame on the left is a menu item. You can click a sub menu on the main menu and click hide sub menu. This is very interesting and practical. Menu Technology can be implemented using the following two technologies:

1. Multi-page technology: the Macromedia Homepage uses this technology. It is to first create a page for the main menu without expanding items, and then create the page after each main menu item is expanded. The number of sub-pages corresponding to the number of items in the main menu must be matched. For example:

<A name = "ABC"> </a>;

<A href = "menu_2.htm # ABC"> <B> CLICK HERE! </B> </a>

......

<A name = "ABC"> </a>

<A href = "menu_1.htm # ABC"> <B> CLICK HERE! </B> </a>

When listing 1 <br> List 2 <br> List 3 <br> is implemented, pay attention to the definition and use of the label <a name = "">, otherwise, it will be messy. In addition, when there are many menu items, remember to use <a name = ""> to define only the currently listed sub-menus. Other main menu items should be linked to their respective expanded pages.

This method is easy to implement and can be supported by any browser, but its disadvantages are also obvious. The first is slow. Calling each page back and forth will inevitably lead to a long wait. Only when the page is full of text will it feel stuck. Then it is difficult to compile the page. Although the technology is simple, however, it is a little troublesome to create one by one. Therefore, this technology has some limitations.

2. DHTML technology: this technology is used on the Microsoft homepage. DHTML is a relatively new technology, so for some "old" browsers, this menu implementation method is powerless. For example, if you click "Click here", you will be directed to the Legal Department, and the Legal Department will say that zookeeper has been playing with the loyal party, and the minister will be in the same region? /P> 〉

<Style type = "text/CSS">

. Nv1 {font-family: Arial; font-weight: bold; font-size:. 9em;

Cursor: hand; margin-top: 10; text-indent:-14; margin-left: 14 ;}

. Nv2

</Style>

......

<SCRIPT type = "text/JavaScript">

Function clikker (a, B ){

If (A. style. Display =)

Else}

</SCRIPT>

......

<Div class = "nv1" id = "BB" onclick = "clikker (bb1, BBP);">

<DD>

Border = "0" width = "11" Height = "11">

Click here

<Div class = "nv2" id = "bb1" style = "display :;"

Onclick = "window. event. cancelbubble = true;">

<A href = "http: // ABC/"> click here </a> </div> </DD> </div>

In the source code ,. nv1 and. nv2 is the CSS font definition. The clikker function controls the display and hiding of menu items, where variable A controls the text and variable B controls the image (not shown in the figure ). In actual applications, pay attention to the range defined by Div. Do not hide other main menu items when you click.

The DHTML technology has a relatively high implementation method. It is fast and easy to create. You only need one page. The disadvantage is that at least the support of IE 4.0 or NC 4.0 or later is required.

2. text color changing

This is the most common technology on the Web. When you move the mouse over an element, the color of the element changes immediately and sometimes sounds like multimedia education software. If the color is well adjusted, the page will be very popular. There are also many ways to achieve text color change. Here we will only briefly introduce the two methods.

1. CSS technology alone. Currently, only Internet Explorer 4.0 supports this technology. For example:

<Style type = "text/CSS">

Body

A: Link

A: visited

A: active

A: hover

</Style>

In this example, the link text is displayed in red at first, and the text changes to blue when you move the mouse over the text. When you click "access", it changes to purple red, and then becomes Chestnut. Netscape does not support CSS attributes such as link, visited, and hover. Therefore, if you use the communicator browser, you will not be able to see these effects.

2. Use JavaScript scripts: for example:

<Script language = "JavaScript">

Function mm_changeprop (objstrns, objstrie, theprop, thevalue ){

VaR theobj = eval (navigator. appname = Netscape )? Objstrns: objstrie );

If (theobj! = NULL) & (theprop. indexof ("style .")! = 0 &&

Theobj. style! = NULL ))

Eval (navigator. appname = Netscape )? Objstrns: objstrie) +. + theprop

+ = "+ Thevalue + ");}

</SCRIPT>

......

<SPAN class = "css1" id = "X"

Onmouseover = "mm_changeprop (, document. All [/X/], style. color,

Red, span )"

Onmouseout = "mm_changeprop (, document. All [/X/], style. color,

Blue, span )"

Change text color </span>

Since IE 4.0 and NC 4.0 have different object control mechanisms, the script needs to check the browser before processing it. The mm_changeprop () function implements this text color change method. This method uses span to define the ID and add onmouseover and onmouseout in every area of the color to be changed, which is much more complicated than the first method. Therefore, select the previous method.

3. Dynamic buttons

The dynamic buttons here are neither GIF animations nor special effects buttons provided by Frontpage. The dynamic buttons are as follows:

When you move the mouse over a button, it suddenly changes. It seems tempting to click it. The following describes the implementation method. Prepare two images. Because they are buttons, they do not need to be large, and the color does not need to be too floral. Just use a simple GIF. There must be some differences between the two images, in this case, the changes cannot be seen later. Its implementation code is:

......

Toc1on = new image (42,197 );

Toc1on. src = "on.home.gif ";

Toc1off = new image (42,197 );

Toc1off. src = "home.gif ";

......

Function img_act (imgname)

Imgon = eval (imgname + "on. SRC ");

Document [imgname]. src = imgon;

......

Function img_inact (imgname)

Imgoff = eval (imgname + "off. SRC ");

Document [imgname]. src = imgoff;

......

<A href = http://www.microsoft.com/

Onmouseover = "img_act (toc1 )"

Onmouseout = "img_inact (toc1)">

</a>

There are two points to note:

1. assign a name to the IMG and apply the name to the source image definition.

2. Pay attention to the various symbols in the source file, especially the quotation marks, and the path of the source image file. It is best to use the relative path to avoid normal display after the site is uploaded. Of course, this image exchange method also requires support from browsers later than version 4.0.

4. Prompt

Place the mouse over an image to display the prompt, just as the buttons of many software provide functional prompts. This function is easy to implement in Webpage editing. The source code is as follows:

......

Title = "my personal archive" alt = "Who am I? ^_^">

......

The title attribute is very useful! It can be used in all elements except base, basefont, Head, HTML, Meta, Param, script, style, and title to define prompt information that is outdated with mouse strokes.

We have discussed some dynamic technologies in the web page preparation process. There are many well-designed and advanced pages on the web. analyzing their source code is a good way to learn. The computer technology is constantly improving. In the face of these new technologies, such as DHTML, CSS, and XML, it is only difficult to grasp and apply it to your own webpage, in order to make the web page more active and vivid.

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.