Js address bar special effects (display the size of all images with links on the page and view the height of the current browser)

Source: Internet
Author: User

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)

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.