Js image loading effect code

Source: Internet
Author: User
Tip: you can modify some code before running

<p><! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br /><Html xmlns = "http://www.w3.org/1999/xhtml" lang = "zh-CN"> <pead> <meta http-equiv = "content-type" content = "text/html; charset = gb2312 "/> <meta http-equiv =" content-language "content =" zh-CN "/> <meta http-equiv =" pragma "content =" no- cache "/> <meta http-equiv =" expires "content =" 0 "/> <meta http-equiv =" MSThemeCompatible "content =" Yes "/> <meta http- equiv = "imagetoolbar" content = "no"/><br /><Meta http-equiv = "widow-target" content = "_ top"/> <meta name = "robots" content = "index, follow "/> <meta name =" author "content =" 3945, [email] ljm77@km169.net [/email] "/><br /><Meta name = "keywords" content = ""/> <meta name = "description" content = ""/> <meta name = "copyright" content = "Copyright 3945 All Rights reserved "/><br /><Title> Untitled Document </title><br /><Style type = "text/css"> <! --<br />A, a: link {text-decoration: none; color: #000000; font-size: 9pt;} a: visited {text-decoration: none; color: #000000 ;} a: hover {text-decoration: underline; color: red ;}<br />Body, td, p, li, div, select {font-size: 9pt; font-family: "";}<br />Img {border: 0 ;}<br />--> </Style><br /><Script type = "text/javascript"></p><p>/* Image loading and processing */<br />Function runImgs ()<br />{<br />Var o = null, d = null, s = null, l = document. images. length;<br />For (var I = 0; I <l; I ++)<br /> {<br />O = document. images [I];<br />If (d = o. getAttribute ('summary '))<br />  {<br />S = eval ('+ d + ')');<br />If (s. w <= 0)<br />   {<br />Window. setTimeout (function (o, s ){<br />Return function (){<br />Var img = new Image ();<br />Img. onerror = function () {with (o) {setAttribute ('width', '000000'), setAttribute ('height', '000000'), setAttribute ('src ', this. src )}};<br />Img. onload = function ()<br />      {<br />Var iw = this. width;<br />Var ih = this. height;<br />Var mx = (0-s.w );<br />Iw = iw> 0? Iw: 80;<br />Iw = s. w <0? (Iw> mx? Mx: iw): iw;<br />O. setAttribute ('src', this. src );<br />O. setAttribute ('width', iw );<br />};<br />Img. setAttribute ('src', s. u );<br />};<br />} (O, s), 1 );<br />   }<br />Else with (o) {setAttribute ('src', s. u), setAttribute ('width', s. w), setAttribute ('height', s. h)}; // specify the size<br />S = null;<br />  }<br />O = d = null;<br /> }<br />}</p><p>Window. onload = function (){<br />RunImgs ();<br />}<br /></Script><br /></Head></p><p><Body><br /> <! -- Specify the size --><br /> <! -- Original size (original image size) --><br /> <! -- Specify the maximum value --><br /> <! -- Specify the maximum value --><br /></Body><br /></Html></p>
Tip: you can modify some code before running

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.