xw) bigimg.width = xw; }" will do."/> xw) bigimg.width = xw; }" will do.">

Home  >  Article  >  CMS Tutorial  >  How to use js to control the size of pictures in the DreamWeaver article page

How to use js to control the size of pictures in the DreamWeaver article page

藏色散人
藏色散人Original
2020-01-04 09:38:382252browse

How to use js to control the size of pictures in the DreamWeaver article page

织梦文章页中怎么用js控制图片的大小?

织梦DEDECMS文章页中用js控制图片的大小

推荐学习:织梦cms

一般不建议使用expression,因为expression对浏览器资源要求比较 高。之前在做一个图集风格的时候在网上看到了一些用js控制图片的例子,我就分享一下给大家!

<script language="javascript">  
     function checkImg(mypic){  
     var xw=720;  
     var width = bigimg.width;  
     if (width > xw ) bigimg.width = xw;  
}  
</script>  
 
<img  id="bigimg" onload="checkImg(this)" src=&#39;/uploads/allimg/100701/co100F1194604-0.jpg&#39;  width=&#39;1023&#39;  alt=&#39;&#39; />

The above is the detailed content of How to use js to control the size of pictures in the DreamWeaver article page. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn