Basic Principle Analysis Windows Shutdown Effect Analysis When users using the Windows system shut down, the interface that appears only allows the user to choose shutdown, logout or cancel actions, but no programs on the desktop can be used, and The screen appears gray. This example will imitate this highlighting effect on a web page. What are the benefits of using this shutdown effect on a web page? First of all, after clicking a certain link, the operations that are not available to the user at this time are hidden in the background, and the available operations are placed at the top of the screen and highlighted, which can avoid misoperation by the user. Secondly, highlighting information can also remind users of things they should pay attention to. Analysis of shutdown effects in web pages The principle of implementing this effect in web pages is very simple. Create two layers, one is the mask layer, covering the entire page and appears in gray; the other layer is the highlighted part, above the mask layer. This can be set by setting the z-index property of the layer. . After canceling the shutdown effect, just delete these two layer elements from the page. The following code implements the display shutdown effect.
AJAX LightBox Sample #lightbox {/*This layer is highlighted Display layer*/
BORDER-RIGHT: #fff 1px solid; BORDER-TOP: #fff 1px solid;
DISPLAY: block; Z-INDEX: 9999; /*Set this layer in At the top of the web page, set it to be large enough*/
BACKGROUND: #fdfce9; /*Set the background color*/ LEFT: 50%;
MARGIN: -220px 0px 0px -250px;
BORDER- LEFT: #fff 1px solid;
WIDTH: 500px;
BORDER-BOTTOM: #fff 1px solid; POSITION: absolute;
TOP: 50%;
HEIGHT: 400px;
TEXT-ALIGN: left
} #overlay {/*This layer is the overlay*/
DISPLAY: block; Z-INDEX: 9998; /*Set the highlight layer below* /
Filter: Alpha (OPACITY = 80);/*Set to transparent*/ left: 0px; Width: 100%; Position: Absolute; TOP: 0px; HEIGHT: 100%; BACKGROUND-COLOR: #000; moz-opacity: 0.8; opacity: .80 }
It should be noted that if there is a tag in IE browser, the tag cannot be covered by the overlay, but it can be covered in other browsers. When using IE browser, you must first hide the element in the web page. For example, the following code can be used to hide all elements on the page. selects = document.getElementsByTagName('select'); for(i = 0; i selects[i].style.visibility = visibility; } <script></script><script></script> One Two In addition, you also need to set the CSS style used by the page. The lightbox.css style sheet file code is as follows: #lightbox { BORDER-RIGHT: #fff 1px solid; BORDER-TOP: #fff 1px solid; DISPLAY: none; Z-INDEX: 9999; BACKGROUND: #fdfce9; LEFT: 50%; MARGIN: -220px 0px 0px -250px; BORDER-LEFT: #fff 1px solid; WIDTH: 500px; BORDER-BOTTOM: #fff 1px solid; POSITION: absolute; TOP: 50%; HEIGHT: 400px; TEXT-ALIGN: left } UNKNOWN { POSITION: fixed } #overlay { DISPLAY: none; Z-INDEX: 5000; FILTER: alpha(opacity=80); LEFT : 0px; WIDTH: 100%; POSITION: absolute; TOP: 0px; HEIGHT: 100%; moz-opacity: 0.8; opacity : .80 } UNKNOWN { POSITION: fixed } .done#lightbox #lbLoadMessage { DISPLAY: none } .done#lightbox # lbContent { DISPLAY: block } .loading#lightbox #lbContent { DISPLAY: none } .loading#lightbox #lbLoadMessage { DISPLAY: block } .done#lightbox IMG { WIDTH: 100%; HEIGHT: 100% } Client script Since browsers have different support for layers, you must first determine The type of client browser. The following code can be used to determine the client's browser and operating system. var detect = navigator.userAgent.toLowerCase(); var OS,browser,version,total,thestring; function getBrowserInfo() { if (checkIt('konqueror')) { browser = "Konqueror"; OS = "Linux"; } else if (checkIt('safari')) browser = "Safari" else if (checkIt('omniWeb')) browser = "OmniWeb" else if (checkIt('opera')) browser = "Opera" else if (checkIt('Webtv')) browser = "WebTV"; else if (checkIt('icab')) browser = "iCab" else if (checkIt('msie')) browser = "Internet Explorer" else if (!checkIt('compatible')) { browser = "Netscape Navigator" version = detect.charAt(8); } else browser = "An unknown browser"; if (!version) version = detect.charAt(place thestring.length); if(!OS) { if (checkIt('linux')) OS = "Linux"; else if (checkIt('x11')) OS = "Unix"; else if (checkIt('mac')) OS = "Mac" else if (checkIt('win')) OS = "Windows" else OS = "an unknown operating system"; } } function checkIt(string) { place = detect.indexOf(string) 1; thestring = string; return place; } 下面看一下网页加载时需要添加的方法。The relevant web page loading and initialization method codes are as follows: //Web page loading calls the initialize and getBrowserInfo methods Event.observe(window, 'load', initialize, false); Event.observe(window, 'load ', getBrowserInfo, false); //Clear the cache when not loaded Event.observe(window, 'unload', Event.unloadCache, false); //Initialization method function initialize( ; document.getElementsByClassName('lbOn'); for(i = 0; i valid = new lightbox(lbox[i]); } } //Use Dom method to create overlay and highlight layer function addLightboxMarkup() { bod = document.getElementsByTagName('body')[0]; overlay = document.createElement ('div'); overlay.id = 'overlay'; lb = document.createElement('div'); lb.id = 'lightbox'; lb.className = ' loading'; lb.innerHTML = ' ' ' ‘; lightbox object.The specific code implementation of this class is as follows: var lightbox = Class.create(); lightbox.prototype = { yPos: 0, xPos: 0, // Construction method, CTRL is the element of the object initialize: function (ctrl) { // assign the link of the element to this.content this.Content = ctrl.href; /// /Add onclick event activate method for this element using using using ctrl. }, //When a link is clicked activate: function(){ if (browser == 'Internet Explorer'){//Judged to be IE browser This.getScroll(); this.prepareIE('100%', 'hidden'); this.setScroll(0,0); This.hideSelects('hidden');// Hide all tags > prepareIE: function( height, overflow){ bod = document.getElementsByTagName('body')[0]; bod.style.height = height; bod.style.overflow = overflow; htm = document.getElementsByTagName('html')[0]; htm.style.height = height; htm.style.overflow = overflow; }, hideSelects: function (visibility){ selects = document.getElementsByTagName('select'); for(i = 0; i selects[i].style.vis ibility = visibility; = self.pageYOffset; } else if (document .documentElement && document.documentElement.scrollTop){ this.yPos = document.documentElement.scrollTop; }else if (document.body) { this.yPos = document.body.scrollTop; } }, setScroll: function(x, y){ 🎜> window. scrollTo(x, y); }, displayLightbox: function(display){ != 'none') this.loadInfo(); }, //This method sends an Ajax request loadInfo: function() { //This method is called when the request is completed processInfo method in the class ); > var result = response.responseText; //Display to highlight layer info = " " result " “; lightbox').className = "done"; This.actions() Bright layer added event handling method reset Event.observe(ctrl, 'click', this.reset.bindAsEventListener(this), false); ctrl.onclick = function(){return false;}; /Clear the returned data $('lbContent') , // Search through new links within the lightbox, and attach click event actions: function(){ lbActions = document.getElementsByClassName('lbAction'); for(i = 0; i Event.observe(lbActions[i], 'click', this[lbActions[i].rel].bindAs EventListener(this), false); lbActions[i ].onclick = function(){return false;}; . Server-side code The server-side first gets the "id" value in the query, and if the value is null or empty, it is set to the default value. Then judge the value and return the corresponding string information.The getInfojsp page code for processing the request is as follows: //Get the value of the id in the request String imgID = request.getParameter("id"); if ( imgID==null||imgID.equals(""))//If it is null or empty imgID="one";//Set to the default value if ( imgID.equals("one" ))//If it is one { %> Porsche Carrera GT The Carrera GT has a 5.7 liter V10 internal combustion engine that produces 605 SAE horsepower (451 kW). Porsche claims it will accelerate from 0 to 100 km/h (62 mph) in 3.9 seconds and has a maximum speed of 330 km/h (204 mph). With 605 HP, The Car Weight 1,380 kg (3,042 LB). The Carrera GT Is only Offered with a Six-Speed Manual Transmission, in the contrast to my Ferrari Enz o that is only offfered with sequential manual transmission. Also the Carrera GT is significantly less expensive than the Ferrari Enzo. The Ferrari Enzo is priced around $660,000 to the Carrera GT's $440,000. The Carrera GT is known for its high quality and reliability ability which makes it one of the best supercars ever. %>
Ferrari Testarossa The Ferrari Testarossa is an V12 mid-engined sports car made by Ferrari. The name, which means "red head", comes from the red painted cylinder heads on the flat-12 engine. The engine was technically a 180?V engine since it shared flat-plane crankshaft pins with opposing cylinders. Output was 390 hp (291 kW), and the car won many comparison tests and admirers - it was featured on the cover of Road & Track magazine nine times in just five years. Almost 10,000 Testarossas, 512TRs, and 512Ms were produced, making this one of the most common Ferrari models despite its high price and exotic design.