How to set the size of the picture by JavaScript
This article mainly explains the "JavaScript how to set the size of the picture", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "JavaScript how to set the size of the picture" bar!
JavaScript sets the size of the picture: first create a HTML sample file; then introduce the picture through img; finally, change the size of the picture dynamically through the "setInterval (function warp () {...}" method.
This article operating environment: windows7 system, javascript1.8.5 version, DELL G3 computer
How does JavaScript set the image size?
JavaScript resizes the picture
Dynamically resize the picture window.function () {var natives 2; var renders 1; var control=true; setInterval (function warp () {if (control==true) {naught +) } else {nmuri;} if (naughty three hundred) control=false;// if (nasty mile1) control=true; if (control==true) {oPic.width+=1; oPic.height+=1 } else {oPic.width-=1; oPic.height-=1;}, 30); / / call the warp function every 30 milliseconds}
Thank you for your reading, the above is the content of "how to set the size of the picture in JavaScript". After the study of this article, I believe you have a deeper understanding of how to set the size of the picture in JavaScript, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!