javascriptÖм¸ÖÖ²Ù×÷´òÓ¡µÄ·½·¨
1¡¡¾Ö²¿´òÓ¡·½·¨£º
×÷Ó㺽«idΪdayinµÄÄÚÈÝ£¬Ð½¨Ò³Ãæ²¢´òÓ¡£¬¿É½â¾ö´òӡijҳÃæÖеIJ¿·ÖÄÚÈݵÄÎÊÌâ¡£
ʹÓ÷½·¨£º½«Òª´òÓ¡µÄÄÚÈÝͨ¹ý <span id="dayin"></span>°üº¬ÆðÀ´£¬È»ºóÔÚij¸ö°´Å¤Öж¨Òå
ʼþ
<input type="button" onclick="dayin()" value="´òÓ¡">
function dayin()
{
var code="<body onload=window.print()>"
code+=document.all.dayin.innerHTML;
code=code.toUpperCase();
code=code.replace(/<A[^>]*>ɾ³ý<\/A>/gi, "");
code=code.toLowerCase();
var newwin=window.open('','','');
newwin.opener = null;
newwin.document.write(code);
newwin.document.close();
}
ÆäÖÐcode=code.replace(/<A[^>]*>ɾ³ý<\/A>/gi, "");
2¡¡ÀûÓÃCSSʵÏÖ¾Ö²¿´òÓ¡
½éÉÜÁ½¸ö¹Ø¼üµÄCSS
<style media="print">
.Noprint { DISPLAY: none }
.PageNext{ PAGE-BREAK-AFTER: always }
</style>µÚÒ»¸öÔÚ²»ÐèÒª´òÓ¡µÄ±êÇ©ÉÏÌí¼Ó£¨×Ó±êÇ©Ò²½«²»±»´òÓ¡£©£¬µÚ¶þ¸öÔÚÐèÒª»»ÐеıêÇ©´¦Ìí¼Ó£¨¸Ã±êÇ©Ëù±íʾµÄÄÚÈݽ«ÔÚµ±Ç°´òÓ¡µÄÒ»Ò³ÄÚ£©
½ÓÏÂÀ´Í¨¹ýµ÷ÓÃ×î»ù±¾µÄjsÓï¾ä
window.print()¾Í¿ÉʵÏÖÒ³Ãæ¾Ö²¿´òÓ¡ÁË£¬ºÜeasy°É£¡
3¡¡´òÓ¡Ô¤ÀÀ
<OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"
height=0 id=wb name=wb width=3></OBJECT>
<input class="ipt" type=button name= button _print value="´òÓ¡"
onclick =" javascript :printit();">
<input class="ipt" type=button name=button _setup value="´òÓ¡Ò³ÃæÉèÖÃ"
onclick =" javascript : printsetup();">
<input class="ipt" type=button name=button_show value="´òÓ¡Ô¤ÀÀ" &
Ïà¹ØÎĵµ£º
ÒÔÇ°ÒòΪ½Ó´¥µÄÏîÄ¿£¬Óõ½javascriptµÄµØ·½£¬±¾È˶ÔjavascriptÕâ¸ö¶«Î÷ÈÏʶ²»¹»£¬ÉõÖÁÒÔΪÊÇǰ̨³ÌÐòÔ±µÄ¹¤×÷¡£×î½ü×öµÄÏîÄ¿ÀïÃæÓõ½Á˺ܶàÕâÖֽű¾ÓïÑÔ£¬²Å·¢ÏÖÕâ¸öС¶«¶«ÊµÔÚÊǺܿɰ®£¬ËäÈ»ºÜÌÔÆø£¨²»ÊǺÜÃæÏò¶ÔÏñ£¬²»ÊǺܺõ÷ÊÔ£©£¬µ«ÊÇÖ»ÒªÊÇ×öweb¿ª·¢µÄ£¬¶¼ÄÑÃâÒª½Ó´¥µ½Ëû£¬°ÑÕ⸠......
JavaScriptÑéÖ¤ÕýÔò±í´ïʽ´óÈ«,ËѼ¯×îÈ«µÄJavaScriptÑéÖ¤ÕýÔò±í´ïʽ,¿ªÊ¼²é¿´°É£¬ÕâÀïµÄ¶¼ÊÇÕýÔò±í´ïʽµÄÀý×Ó£¬¾ßÌåºÍº¯Êý½áºÏµÄʹÓ÷½·¨£¬»¹Çë²é¿´ÏÂƪÎÄÕ¡¶JavaScriptʹÓÃÕýÔò±í´ïʽ½øÐÐÑéÖ¤¡·
Æ¥ÅäÖÐÎÄ×Ö·ûµÄÕýÔò±í´ïʽ£º [u4e00-u9fa5]
ÆÀ×¢£ºÆ¥ÅäÖÐÎÄ»¹ÕæÊǸöÍ·ÌÛµÄÊ£¬ÓÐÁËÕâ¸ö±í´ïʽ¾ÍºÃ°ìÁË
Æ¥ÅäË«×Ö½Ú×Ö·û(°üÀ ......
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"></textarea& ......
ʼþÔ´¶ÔÏó
event.srcElement.tagName
event.srcElement.type
²¶»ñÊÍ·Å
event.srcElement.setCapture();
event.srcElement.releaseCapture();
ʼþ°´¼ü
event.keyCode
event.shiftKey
event.altKey
event.ctrlKey
ʼþ·µ»ØÖµ
event.returnValue
Êó±êλÖÃ
event.x
event.y
´°Ìå»î¶¯ÔªËØ
d ......
javascript typeofµÄÓ÷¨
¾³£»áÔÚjsÀïÓõ½Êý×é,±ÈÈç ¶à¸öÃû×ÖÏàͬµÄinput, ÈôÊǶ¯Ì¬Éú³ÉµÄ, Ìύʱ¾ÍÐèÒªÅжÏÆäÊÇ·ñÊÇÊý×é.
if(document.mylist.length != "undefined" ) {} Õâ¸öÓ÷¨ÓÐÎó.
ÕýÈ·µÄÊÇ if( typeof(document.mylist.length) != "undefined" ) {}
»ò if( !isNaN(document.mylist.length) ) {}
typeofµÄÔË ......