Javascript checks the image size to keep the large image from bursting the page


How to use Javascript to determine the size of an image is actually as simple as writing a function, which of course many people don’t know how to do. Found that using ASP to judge the size of the picture than a number of cattle is complicated, and judged on the judgment, but also logic display. . Pest. With Javascript, it’s easy to do, and the end result is not to let the big picture burst the page.

<script LANGUAGE= " JAVASCRIPT " >

//Check if the image size is larger than expected. Greater than shows the expected size

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. Mouse over the automatically selected check box:

<input TYPE= " checkbox "  onMouseMove= " checked=true " >

<input TYPE= " checkbox "  onMouseMove= " checked=true " >

2.ACCESS  List the number of days of the week that a given day falls on

//This algorithm took me an hour or so

 Querying for all days of the week to which a date belongs

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.  Double click to copy the text,   Now, just double click

<script LANGUAGE= " JAVASCRIPT " >

function ClipBoard ( tdObj )  { //IE Only

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

holdtext.innerText = tdObj.innerText;

Copied = holdtext.createTextRange (a) ;

Copied.execCommand (" Copy "). ;

alert (" text copied "). ;

}

</script>

<form NAME= " form1 "  METHOD= " post "  ACTION= "" >

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

</form>