[Message prompt component], compatible with IE6/7 & amp; FF2

Source: Internet
Author: User

Author: yemoo
Source: WWW. AJAXBBS. NET
Released on: 2007-09-03

Address: http://www.ajaxbbs.net/blog/post/100/

Note: This is only a js component used by a pure client. It is a non-Server Control (such as asp.net control) and is only used to beautify message prompts.

PS: I hope you will give more practical suggestions or comments. If appropriate, I will continue to improve the modification.
========================================================== ======================================
Some time ago, the company needed to write a small component to replace the default gray messaging component (alert/Confirm) of windows. Because the system developed by the company is mainly for IE browsers, therefore, the code that started to run in ff is invalid. Today, we plan to share the Code. In order to minimize the impact of bricks, we spent nearly an hour modifying the code compatibility, currently, it runs normally in ie6.0 and FF2.0, and other browsers are not tested. The company is working on the task, so it is too lazy to spend a lot of time completing the task to meet most of the requirements.

Component introduction:

1. Perform Secondary package in the call method. First, encapsulate the call method into a class, and then convert the call method into several simple method calls. No new call is required. The call method is clear and simple.
2. compatible with IE6.0 & FF2.0.
3. Currently, three types of skin are available: Vista, QQ, ExtBlue, and BlackColl. If you are interested, you can modify the style sheet file to define a new skin.
4. Four message types are provided. They are message prompts, success messages, error messages, and inquiry messages.
5. When a message box is displayed, operations on other elements on the page are blocked. select and select under iframe are automatically hidden, and iframe and other elements are masked.
6. The select control remains in the original state when the status of the page is restored. That is, if the select control is hidden, the select control remains hidden after the message box pops up and is disabled, only the previously displayed select is displayed.
7. When the message component pops up, the operation on the keyboard Tab and Space key is blocked (to prevent keyboard operation page elements). Press Enter as the "OK" button of the message component.


Introduction:
1. First introduce ymPrompt. js on the page.
2. Call the required message function:
(1) Alert (content, width, height, title, okFunc, cancelFunc) // Message Type
(2) SucceedInfo (...) // successful information type
(3) ErrorInfo (...) // error message type
(4) ConfirmInfo (...) // query the Message Type

The parameters of the four methods are identical:

Content: The content to be displayed by the message component.
Width: the width of the message box. If this parameter is not set, set null to adaptive width.
Height: the height of the message box. If this parameter is not set, set it to null. The height is adaptive.
Title: Message component title
OkFunc: name of the function executed when you click OK.
CancelFunc: name of the function executed when you click the cancel or close button.

View Demo: http://www.ajaxbbs.net/test/ymPrompt/demo.htm
Note: the reason for the speed of the network space is that opening the demo for the first time may result in slow image loading. Please open the demo and download the image or the source code to view the demo.
Download source code here: http://www.ajaxbbs.net/blog/post/100/

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.