Óà JavaScript ʵÏÖÍøҳͼƬµÈ±ÈÀýËõ·Å
<script language="JavaScript" type="text/javascript">
<!--
// ˵Ã÷£ºÓà JavaScript ʵÏÖÍøҳͼƬµÈ±ÈÀýËõ·Å
// ÕûÀí£ºhttp://www.CodeBit.cn
function DrawImage(ImgD,FitWidth,FitHeight)
{
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0)
{
if(image.width/image.height>= FitWidth/FitHeight)
{
if(image.width>FitWidth)
{
ImgD.width=FitWidth;
ImgD.height=(image.height*FitWidth)/image.width;
}else
{
&
Ïà¹ØÎĵµ£º
jsÑéÖ¤±íµ¥´óÈ«
1. ³¤¶ÈÏÞÖÆ
<script>
function test()
{
if(document.a.b.value.length>50)
{
alert("²»Äܳ¬¹ý50¸ö×Ö·û£¡");
document.a.b.focus();
return false;
}
}
</script>
<form name=a onsubmit="return test()">
<textarea name="b" cols="40" wrap="VIRTUAL" rows="6"&g ......
ת»¯ÎªBooleanÀàÐÍ
ËùÓÐJavaScriptÖеÄÖµ¶¼ÄÜÒþʽµÄת»¯ÎªBooleanÀàÐÍ£¬±ÈÈ磺
0 == false; // true
1 == true; // true
'' == false // true
null == false // true
µ«ÊÇÕâЩֵ¶¼²»ÊÇBooleanÀàÐÍ¡£
Òò´Ëµ±ÎÒÃÇʹÓÃÈý¸öµÈ ......
var a = document.getElementById("left");
var b = document.getElementById("right");
if(a.scrollHeight < b.scrollHeight)
{
a.style.height = b.scrollHeight+”px”;
} &nb ......
"^\d+$"¡¡¡¡//·Ç¸ºÕûÊý£¨ÕýÕûÊý + 0£©
"^[0-9]*[1-9][0-9]*$"¡¡¡¡//ÕýÕûÊý
"^((-\d+)|(0+))$"¡¡¡¡//·ÇÕýÕûÊý£¨¸ºÕûÊý + 0£©
"^-[0-9]*[1-9][0-9]*$"¡¡¡¡//¸ºÕûÊý
"^-?\d+$"¡¡¡¡¡¡¡¡//ÕûÊý
"^\d+(\.\d+)?$"¡¡¡¡//·Ç¸º¸¡µãÊý£¨Õý¸¡µãÊý + 0£©
"^(([0 ......
°æ±¾£ºDHTML Object Model¡¡·µ»ØÖµ£ºÓÐ
Óï·¨£º
oTextRange = object . createTextRange ()
²ÎÊý£º
ÎÞ
·µ»ØÖµ£º
oTextRange : ¶ÔÏó(Element)¡£Èç¹û³É¹¦µÄ»°·µ»Ø±»½¨Á¢µÄ TextRange ¶ÔÏó¡£
˵Ã÷£º
Ϊ object ½¨Á¢ TextRange ¶ÔÏó¡£
ʹÓÃ´Ë TextRange ¶ÔÏó¿ÉÒÔ¼ìË÷ºÍÐÞ¸Ä object ÄÚµÄÎı¾¡£ TextRange ¶ÔÏ ......