Javascript upload the picture to achieve a proportional scaling and display intact
Related Tags:
1, in accordance with the proportion of the zoom
<script Language="javascript">
Function changeImg (mypic) (
Var xw = 130;
Var xl = 160;
Var Width = mypic.width;
Var Height = mypic.height;
If (width> xw) mypic.width = xw;
If (height> xl) mypic.height = xl;
)
</ Script>
<img Src="sh180.jpg" onload="changeImg(this)"> 2, in accordance with the proportion of the zoom
Function changeImg (mypic) (
Var xw = 130;
Var xl = 160;
Var Width = mypic.width;
Var Height = mypic.height;
If (width> xw) mypic.width = xw;
If (height> xl) mypic.height = xl;
)
</ Script>
<img Src="sh180.jpg" onload="changeImg(this)"> 2, in accordance with the proportion of the zoom
<script Language="javascript">
Function changeImg1 (mypic) (
Var xw = 160;
Var xl = 180;
Var width = mypic.width;
Var height = mypic.height;
Var bili = width / height;
Var A = xw / width;
Var B = xl / height;
If (A> 1 | | B> 1)
(
If (A <B)
(
Mypic.width = xw;
Mypic.height = xw / bili;
)
If (A> B)
(
* = Xl mypic.width bili;
Mypic.height = xl;
)
)
)
</ Script>
<img Src="sh180.jpg" onload="changeImg(this)">
Related articles:Function changeImg1 (mypic) (
Var xw = 160;
Var xl = 180;
Var width = mypic.width;
Var height = mypic.height;
Var bili = width / height;
Var A = xw / width;
Var B = xl / height;
If (A> 1 | | B> 1)
(
If (A <B)
(
Mypic.width = xw;
Mypic.height = xw / bili;
)
If (A> B)
(
* = Xl mypic.width bili;
Mypic.height = xl;
)
)
)
</ Script>
<img Src="sh180.jpg" onload="changeImg(this)">
- Div accelerate the use of the display pages
- CSS properties and Visibility Display
- CSS display property Senior Guide
- Javascript full-screen display issues
- Fireworks display physical production
- Fireworks display map clips effect
- CSS in-depth understanding of the display: inline-block attributes
- CSS display, in which visibility and distinction?
- Javascript control with the display and hidden div
- Display hidden div
- Different resolution display different connection
- On display: inline with the float: left correct understanding of the meaning of!
- Novel and practical effect of the display picture
- Google AdSense advertising display
- On display: inline with float: left; awareness
- Alexa Toolbar in your logo on display
- Display: inline-block attributes
- CSS in IE and Nascape display differences
- LRC display lyrics flash Principle
- Javascript control DIV display
Recommended reading Concise Guide to HTML

"Hypertext markup language" Concise Seeker (Chinese version) (This article applies to all browsers) Connecting to the Internet network, in the colorful WWW browser's home page, for the average user has no stranger, how to prepare their own home pages...
CSS and C # in div automatically completed another Flooding

<div Id="main"> <div Id="div1" onclick="clickfun();" /> <div Id="div2" onclick="clickfun2();"> </ div> </ Div> <! - This way, unable to form a wide div1 ...
CSS how to achieve effective alternative picture

CSS how to achieve effective alternative picture (# Newone Display: block; Padding: 0; Margin: 0; Background: url (/ newone.gif) no-repeat; Width: 40px; Height: 20px; ) &nbs...
Performance affinity sites: Let your website for public lover

It is the popularity of the personal homepage, as long as the Internet, will shuttle people in the streets and alleys of the Internet. It is undeniable that these sites are good everywhere, but not worth mentioning site is not uncommon. Clearly, whether or Netizen s...
Flash ActionScript 3.0 tutorial series

The author's blog: www.kingda.org ActionScript 3.0 tutorial series (1): Flash9 first come first intimate contact! Flash Professional 9 ActionScript 3.0 Preview version released today, and the subsequent we not only from the use of Flex 2 to use AS3.0, but also...