ASP. NET uses greybox to describe greybox advanced usage

Source: Internet
Author: User
Use greybox to describe ASP. NET
 

Use greybox to describe ASP. NET

Recently, it is easy to see this effect, that is, when you select a video or link in the webpage, the background will immediately become dark and the loading... Then jump out of a beautiful box to show the picture or webpage. This effect is called lightbox.

In addition to images and webpages, The greybox can be used to display images, Flash files, and videos in the box displayed by lightbox.

 

I. Security Department

Program (http://orangoo.com/labs/GreyBox/Download)

Deploy the solution to the root website

Ii. Usage

'Before its announcement

System. Web. httpcontext. Current. response. Write ("<SCRIPT type =" "text/JavaScript" "> ")

System. Web. httpcontext. Current. response. Write ("Var gb_root_dir =" "greybox /"";")

System. Web. httpcontext. Current. response. Write ("</SCRIPT> ")

System. web. httpcontext. current. response. write ("<SCRIPT type =" "text/JavaScript" "src =" "greybox/AJS. JS ""> </SCRIPT> ")

System. Web. httpcontext. Current. response. Write ("<SCRIPT type =" "text/JavaScript" "src =" "greybox/ajs_fx.js" "> </SCRIPT> ")

System. Web. httpcontext. Current. response. Write ("<SCRIPT type =" "text/JavaScript" "src =" "greybox/gb_scripts.js" "> </SCRIPT> ")

System. web. httpcontext. current. response. write ("<link href =" "greybox/gb_styles.css" "rel =" "stylesheet" "type =" "text/CSS" "/> ")

'Call founction (a href method)

'Example 1: show the 200*100 webpage, with the goal of "warning messages" and sending messages to message. aspx

System. web. httpcontext. current. response. write ("<a href =" "message. aspx "" Title = "" Warning interest "" rel = "" gb_page_center [200,100] "> show 200*100 webpages </a> ")

'Example 2: start a full-version Google website

System. web. httpcontext. current. response. write ("<a href =" "http://google.com/" Title = "" google "" rel = "" gb_page_fs [] ""> launch Google.com in fullscreen window </a>")

'Example 3: start the first video.

System. web. httpcontext. current. response. write ("<a href =" "http://orangoo.com/labs/greybox/static_files/night_valley.jpg" "rel =" "gb_imageset [nice_pics]" "Title =" "page1"> </a> ")

'Activate the second release

System. web. httpcontext. current. response. write ("<a href =" "http://orangoo.com/labs/greybox/static_files/night_valley.jpg" "rel =" "gb_imageset [nice_pics]" "Title =" "page2"> </a> ")

'Call the function (directly show off)

System. web. httpcontext. current. response. write ("<SCRIPT> AJS. AEV (window, 'load', function () {gb_showcenter ("" Hello World "","".. /message. aspx "", 200,200) ;}); </SCRIPT> ")

Iii. Questions and answers

Original article address

Q: which regions do I need to renew to make greybox work?

You only need to solve the greybox deployment errors in the restored greybox deployment errors.

Q: Why can't images be displayed only when they are stored in greybox images?

Your gb_root_dir has not been set to correct.

Q: How can I configure my own relationship between nodes and click between nodes?

<A href = "#" onclick = "parent. Parent. gb_hide ();"> my close button </a>


Q: How can I use greybox to insert a plane?

Greybox uses the signature plane injection command of AJS connector.
AJS. AEV (window, 'load', function () {gb_show ("Hello World", "http://google.com ");});

Q: How can I make greybox appear in the upper plane?

Gb_show of standard definition is as follows:

Gb_show = function (Caption, URL,/* optional */height, width, callback_fn ){
VaR Options = {
Caption: caption,
Height: height | 500,
Width: width || 500,
Fullscreen: false,
Callback_fn: callback_fn
}
VaR win = new gb_window (options );
Return win. Show (URL );
}

Because in the greybox/base. js environment, we use the following statistics:

Init: function (options ){
This. type = "page ";
This. overlay_click_close = false;
This. Salt = 0;
This. root_dir = gb_root_dir;
This. callback_fns = [];
This. reload_on_close = false;
This. src_loader = This. root_dir + 'loader_frame.html ';
This. show_loading = true;
AJS. Update (this, options );
},

We can see that the show_loading parameter value is true, so we can create a new function (named gb_myshow at runtime)

Gb_myshow = function (Caption, URL,/* optional */height, width, callback_fn ){
VaR Options = {
Caption: caption,
Height: height | 500,
Width: width || 500,
Fullscreen: false,
Show_loading: false,
Callback_fn: callback_fn
}
VaR win = new gb_window (options );
Return win. Show (URL );
}

Note that the show_loading in the preceding statement is false, and then reference this function.

<A href = "http://google.com/" onclick = "Return gb_myshow ('Google ', this. href)"> visit Google </a>

Similarly, we can also modify overlay_click_close to realize the effect of the close relationship.
Q: How to Use WordPress?
WordPress can be created in a second category. Therefore, use the correct method.

<SCRIPT type = "text/JavaScript" src = "http://www.my-wordpress-site.com/greybox/AJS.js"> </SCRIPT> <SCRIPT type = "text/JavaScript" src = "http://www.my-wordpress-site.com/greybox/AJS_fx.js"> </SCRIPT> <script type = "text/JavaScript" src = "http://www.my-wordpress-site.com/greybox/gb_scripts.js"> </SCRIPT> <link href = "http://www.my-wordpress-site.com/greybox/gb_styles.css" rel = "stylesheet" type = "text/CSS">

 

Q: How to use Google Maps?

Search for help using Google APIs or discussion forums.

Q: Why can't I use it in a Dreamweaver webpage?

Upload the mm_imagepreloader from the response, and then modify it.

<Body onload = "..."> to just <body>

Greybox advanced usage

Because the project needs to use a pop-up window or a simulated window, this time has been studied and there are many solutions, such as window. open (); window. showdialog (); layer-based simulation, frame + Div + JavaScript ....
Window. open (); the disadvantage of this method is that it will be blocked by the browser or related software. It is difficult to use a layer-based simulation to implement a window with complicated points. The third method is to integrate all the website creation knowledge and provide a good solution. However, the third implementation is difficult for those with insufficient JavaScript knowledge. Some time ago, when I went online, I found a good solution: greybox. after repeated research, it is found that greybox can complete almost all the pop-up windows (however, it seems that it is not supported by the Framework ). For ease of use, I encapsulate greybox as a control. Post the usage:
1. involved files: greybox. dll (dynamic library) greyboxloader. aspx, greyboxloader. aspx. CS (,, gb_styles.css (style sheet)
2. Add a file:
① Add reference greybox. DLL to the bin folder
② Add greyboxloader. aspx, greyboxloader. aspx. CS to the project root directory.
③ Upload the gb_styles.css file to the imges/CSS/folder.
3. Call method:
① Reference controls:
Add the code at the top of the page: <% @ register Assembly = "greybox" namespace = "greybox" tagprefix = "PC3" %>
Add the following code between <form> </form>: <PC3: greybox id = "geybox1" runat = "server"> </PC3: greybox>
② Load the CSS file:
Htmllink myhtmllink = new htmllink ();
Myhtmllink. href = "images/CSS/gb_styles.css ";
Myhtmllink. Attributes. Add ("rel", "stylesheet ");
Myhtmllink. Attributes. Add ("type", "text/CSS ");
Page. header. Controls. Add (myhtmllink );
③ Register a new window event (take the button as an example ):
This. button1.attributes. Add ("onclick", "Return gb_showcenter ('change password', 'echangepw. aspx ', 200,390 )");
Parameters of the gb_showcenter ('title', 'url', height, width) method are described as follows:
Title: The title of the pop-up window
URL: URL or webpage file name
Height: the height of the pop-up window.
Width: the width of the pop-up window.
In this way, click button1 to bring up a window.
4. Method:
Close the window:
Response. Write ("<script language = JavaScript> parent. Parent. gb_hide (); </SCRIPT> ");
Submit and close the window:
IFRAME)
Response. Write ("<script language = JavaScript> parent.parent.doc ument. Forms (0). Submit (); </SCRIPT> ");
No Frame
Response. Write ("<script language = JavaScript> top.20.20.doc ument. Forms (0). Submit (); </SCRIPT> ");
Original greybox File Download: http://www.cnblogs.com/Files/coding1016/GreyBox_v5_5.rar
Package greybox File Download: http://www.cnblogs.com/Files/coding1016/GreyBox (2005).zip
Note: all resources of greybox belong to the original author. If you are interested, you can go to the greybox website. I have a detailed introduction. Of course, I can discuss it with you. I would like to share it with you.

Http://hi.baidu.com/xiao%5Fwei2008/blog/item/9dd3b41b2d89c9ffaf513385.html

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.