JavaScriptÔËÐдúÂë¿ò´úÂë
JavaScriptÔËÐдúÂë¿ò´úÂë
<script language="JavaScript" type="text/JavaScript">
//ÔËÐÐÎı¾Óò´úÂë
function runEx(cod1) {
cod=document.all(cod1)
var code=cod.value;
if (code!=""){
var newwin=window.open(’’,’’,’’); //´ò¿ªÒ»¸ö´°¿Ú²¢¸³¸ø±äÁ¿newwin¡£
newwin.opener = null // ·ÀÖ¹´úÂë¶ÔÂÛÌ¸Ò³ÃæÐÞ¸Ä
newwin.document.write(code); //ÏòÕâ¸ö´ò¿ªµÄ´°¿ÚÖÐдÈë´úÂëcode£¬ÕâÑù¾ÍʵÏÖÁËÔËÐдúÂ빦ÄÜ¡£
newwin.document.close();
}
}
</script>
<textarea name="textarea" cols="60" rows="10" id="rn01">Ìí¼ÓHTML´úÂë</textarea>
<br />
<INPUT onclick="runEx(’rn01’)" type="button" value="ÔËÐдúÂë" style="cursor:hand">
[Ctrl+A È«²¿Ñ¡Ôñ Ìáʾ£ºÄã¿ÉÏÈÐ޸IJ¿·Ö´úÂ룬ÔÙ°´ÔËÐÐ]
Ïà¹ØÎĵµ£º
1.»ñµÃÖ¸¶¨idµÄ¶ÔÏó£ºdocument.getElementById ("id")£¬idÐèΨһ£¬name²»±ØÎ¨Ò»¡£
2.»ñµÃÖ¸¶¨nameµÄ¶ÔÏóÊý×飺document.getElementsByname("name")£¬·ÃÎʾßÌå¶ÔÏóÓÃϱê±íʾ£ºdocument.getElementsByname("name")[0]
3. »ñµÃ´¥·¢Ê¼þµÄ¶ÔÏó£º
function getEventElement(ev){
ev = ev||window.event;//»ñµÃ¶ÔÏó
......
/********************
* È¡´°¿Ú¹ö¶¯Ìõ¸ß¶È
******************/
function getScrollTop()
{
var scrollTop=0;
if(document.documentElement&&document.documentElement.scrollTop)
{
......
±íµ¥Ãûfm ±íµ¥ÖÐÓÐÁ½¸ötext :name,no Ò»¸öradio:sex Ò»¸öcheckbox:hobby Ò»¸öÏÂÀÁбí¿ò(ÈÕÆÚ£ºyear month day)
Ò»¸ötextarea ……»¹ÓÐÁ½¸ö°´Å¥ submit ºÍ reset
ÈçºÎÓÃJavaScriptÑéÖ¤ÕâЩÄÚÈݷǿգ¬ÒªÇóµã“Ìá½»”°´Å¥µÄʱºò Ìáʾ·Ç¿Õ£¬ ¾ßÌåhtml´úÂëÈçÏ£º
<html>
<he ......
Ö»ÄÜÊäÈëÊý×Ö£º"^[0-9]*$"
Ö»ÄÜÊäÈë n λµÄÊý×Ö£º"^\d{n}$"
Ö»ÄÜÊäÈëÖÁÉÙ n λµÄÊý×Ö£º"^\d{n,}$"
Ö»ÄÜÊäÈë m ¡« n λµÄÊý×Ö£º"^\d{m,n}$"
Ö»ÄÜÊäÈëÁãºÍ·ÇÁ㿪ͷµÄÊý×Ö£º"^(0|[1-9][0-9]*)$"
Ö»ÄÜÊäÈëÓÐÁ½Î»Ð¡ÊýµÄÕýʵÊý£º"^[0-9]+(.[0-9]{2})?$"
Ö»ÄÜÊ ......
ÔÚÄÄÀï·ÅÖÃ JavaScript
Ò³ÃæÖеĽű¾»áÔÚÒ³ÃæÔØÈëä¯ÀÀÆ÷ºóÁ¢¼´Ö´ÐС£ÎÒÃDz¢²»×ÜÏ£ÍûÕâÑù¡£ÓÐʱ£¬ÎÒÃÇÏ£Íûµ±Ò³ÃæÔØÈëʱִÐнű¾£¬¶øÁíÍâµÄʱºò£¬ÎÒÃÇÔòÏ£Íûµ±Óû§´¥·¢Ê¼þʱ²ÅÖ´Ðнű¾¡£
λÓÚ head ²¿·ÖµÄ½Å±¾£º
µ±½Å±¾±»µ÷ÓÃʱ£¬»òÕßµ±Ê¼þ±»´¥·¢Ê±£¬½Å±¾¾Í»á±»Ö´ÐС£µ±Äã°Ñ½Å±¾·ÅÖõ½ head ²¿·Öºó£¬¾Í¿ÉÒÔÈ·±£ÔÚÐèÒªÊ ......