The address bar javascript refers to the use of javascript pseudo protocol in the browser's address bar by executing code similar to javascript: alert ("hello wow"); void (0, the usage is to input javascript: xxx code in the address bar of the page that has been opened and loaded to execute the code. The following uses two practical Javascript Address Bar special effects as an example to illustrate.
1. display the size of all connected images on the page (imitating the rendering Effect of Microsoft IE official plug-in)
javascript:a=document.images;d=document;for(i=0;i<a.length;i++){t=a[i];p=t.parentNode;if(p.tagName == "A"){p.style.position="relative";p.style.display="block";p.style.width=t.width+"px";p.style.height=t.height+"px";s=d.createElement("span");s.style.position="absolute";s.style.color = "white";s.style.backgroundColor = "red";s.style.right="0px";s.style.bottom="0px";s.innerHTML=t.width+"x"+t.height;p.appendChild(s);}}void(0);
2. view the browser height
javascript:alert(window.screen.availHeight);void(0);
Articles you may be interested in
- Display text box effects of line numbers, compatible with browsers such as ie and Firefox
- Move the mouse over the text to display the floating layer prompt special effects (compatible with all browsers such as IE and Firefox)
- PHP obtains the regular expression of all links on the page.
- How to set the DIV layer to display on a flash object, compatible with browsers such as ie and firefox
- Jquery drop-down menu (ultra-simple and practical, compatible with mainstream browsers such as IE and firefox)
- Js obtains the height of the scroll bar from the top and bottom of the browser. It is compatible with ie and firefox.
- Javascript determines whether the mouse is left or right-click-compatible with ie, firefox, chrome, and other major browsers
- Jquery pop-up window plug-in (compatible with all browsers)