Home > Web Front-end > JS Tutorial > Javascript checks image size and does not let large images break the page_javascript skills

Javascript checks image size and does not let large images break the page_javascript skills

WBOY
Release: 2016-05-16 16:31:55
Original
1398 people have browsed it

How to use Javascript to determine the image size. In fact, you only need to write a simple function. Of course, many people may not know how to write such a judgment. I found that using ASP to determine the image size is more complicated than counting hairs, and once it is determined, it is judged, and it needs to be displayed logically. ..bother. Use Javascript to judge and do it easily. The final effect is just not to let the big picture break the page.

<script LANGUAGE=“JAVASCRIPT”>

//检查图片大小是否大于预期大小, 大于则显示为预期大小

function show(chkw) { //chk images width

if(chkw>500) {

chkw=500;

}

else {

chkw=chkw;

}

return chkw;

}//shawl.qiu script

//example <img src=“images/teach/opera/01.jpg” onload=“this.width=show(this.width)” >

</script>

1.鼠标经过自动选取的复选框:

<input TYPE=“checkbox” onMouseMove=“checked=true”>

<input TYPE=“checkbox” onMouseMove=“checked=true”>

2.ACCESS 列出某一天所属星期的天数

//这个算法可费了我个把小时

查询一个日期所隶属星期所有天数的数据

SELECT *

FROM ctdate_by_query_date

WHERE dateandtime between ((#2006-5-15#+Weekday(2006-5-15))-6) and #2006-5-15#+Weekday(2006-5-15)

3. 双击滑鼠拷贝文本, 现在双击一下就清楚

<script LANGUAGE=“JAVASCRIPT”>

function ClipBoard(tdObj) { //IE Only

var holdtext = document.all[‘holdtext'];

holdtext.innerText = tdObj.innerText;

Copied = holdtext.createTextRange();

Copied.execCommand(“Copy”);

alert(“text copied”);

}

</script>

<form NAME=“form1” METHOD=“post” ACTION=“”>

<ttextarea id=“holdtext” style=“display:none” ROWS=“10”></ttextarea>

</form>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template