Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javascript ¶¯Ì¬´´½¨±í¸ñ

ÀûÓÃjsÀ´¶¯Ì¬´´½¨±í¸ñÓÐÁ½ÖÖ¸ñʽ£¬appendChild()ºÍinsertRow¡¢insertCell()¡£Á½ÖÖ·½Ê½Æäʵ²î²»¶à£¬µ«µÚÒ»ÖÖÓпÉÄÜÔÚIEÉÏÓÐÎÊÌ⣬ËùÒÔÍƼö´ó¼ÒʹÓõڶþÖÖÁË£¬Ö±½Ó˵°É¡£
1¡¢inserRow()ºÍinsertCell()º¯Êý
insertRow()º¯Êý¿ÉÒÔ´ø²ÎÊý£¬ÐÎʽÈçÏ£º
insertRow(index)£ºindex´Ó0¿ªÊ¼
Õâ¸öº¯Êý½«ÐÂÐÐÌí¼Óµ½indexµÄÄÇÒ»ÐÐÇ°£¬±ÈÈçinsertRow(0),Êǽ«ÐÂÐÐÌí¼Óµ½µÚÒ»ÐÐ֮ǰ¡£Ä¬ÈϵÄinsertRow()º¯ÊýÏ൱ÓÚinsertRow(-1)£¬½«ÐÂÐÐÌí¼Óµ½±íµÄ×îºó¡£Ò»°ãÎÒÃÇÔÚʹÓõÄʱºò¶¼ÊÇ£ºobjTable.insertRow(objTable.rows.length).¾ÍÊÇΪ±í¸ñobjTableÔÚ×îºóÐÂÔöÒ»ÐС£
insertCell()ºÍinsertRowµÄÓ÷¨Ïàͬ£¬ÕâÀï¾Í²»ÔÙ˵ÁË¡£
2¡¢deleteRow()ºÍdeleteCell()·½·¨
deleteRow()º¯Êý¿ÉÒÔ´ø²ÎÊý£¬ÐÎʽÈçÏ£ºdeleteRow(index)£ºindex´Ó0¿ªÊ¼
ºÍÉÏÃæÁ½¸ö·½·¨²î²»¶àµÄÒâ˼£¬¾ÍÊÇɾ³ýÖ¸¶¨Î»ÖõÄÐк͵¥Ôª¸ñ¡£Òª´«ÈëµÄ²ÎÊý£ºIndexÊÇÐÐÔÚ±í¸ñÖеÄλÖ㬿ÉÒÔÏÂÃæµÄ·½·¨È¡µÃÈ»ºóȥɾ³ý£º
var row=document.getElementById("ÐеÄId");
var index=row.rowIndex;//ÓÐÕâ¸öÊôÐÔ£¬ºÙºÙ
objTable.deleteRow(index);
ÔÚʹÓùý³ÌÖÐÎÒÅöµ½µÄÒ»¸öÎÊÌâ¸ú´ó¼Ò˵һÏ£¬¾ÍÊÇɾ³ý±í¸ñµÄÐеÄʱºò£¬Èç¹ûÄãɾ³ýÁËijһÐУ¬ÄÇô±í¸ñÐÐÊýÊÇÂíÉϾͱ仯µÄ£¬ËùÒÔÈç¹ûÄãҪɾ³ý±í¸ñµÄËùÓÐÐУ¬ÏÂÃæµÄ´úÂëÊÇ´íÎóµÄ£º
function clearRow(){
   objTable= document.getElementById("myTable");
     
   for( var i=1; i<objTable.rows.length ; i++ )
   {
   tblObj.deleteRow(i);   
      }
}
Õâ¶Î´úÂëҪɾ³ýÔ­À´µÄ±í¸ñµÄ±íÌ壬ÓÐÁ½¸öÎÊÌâ¡£Ê×ÏȲ»ÄÜÊÇdeleteRow(i)£¬Ó¦¸ÃÊÇdeleteRow(1)¡£ÒòΪÔÚɾ³ý±í¸ñÐеÄʱºò£¬±í¸ñµÄÐÐÊýÔڱ仯£¬Õâ¾ÍÊÇÎÊÌâµÄ¹Ø¼ü£¬rows.length×ÜÊÇÔÚ±äС£¬É¾³ýµÄÐÐÊý×ÜÊÇ»á±ÈÔ¤ÏëµÄÒªÉÙÒ»°ë£¬ËùÒÔÕýÈ·µÄɾ³ý±í¸ñµÄÐеĴúÂëÓ¦¸ÃÕâÑù£º
function clearRow(){
   objTable= document.getElementById("myTable");
   var length= objTable.rows.length ;
   for( var i=1; i<length; i++ )
   {
       objTable.deleteRow(i);   
      }
}
3¡¢¶¯Ì¬ÉèÖõ¥Ôª¸ñÓëÐеÄÊôÐÔ
A¡¢²ÉÓÃsetAttribute()·½·¨£¬¸


Ïà¹ØÎĵµ£º

ÈçºÎÓÃJavascript¼ì²éAdobe PDF²å¼þÊÇ·ñ°²×°

ÓÃJavascript¼ì²éAdobe PDF²å¼þÊÇ·ñ°²×°µÄ´úÂëÈçÏ£º
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; ......

JavaScriptÉèÖôúÂëÑÓʱִÐÐ

//ÈÃij¶Î´úÂëÑÓʱִÐÐ
function delayRun(code, time) {
        var t = setTimeout(code, time);
}
Ó¦ÓþÙÀý£º
<input type="button" name="query" value="ͳ¼Æ" class="long_button" onClick="return delayRun('onQuery()', 1000);"> ......

javascript±ä»¯µÄʱÖÓ

<script language="JavaScript">
<!--
function check(val){
 if (val<10){
  return("0"+val);
 }else{
  return(val);
 }
}
function ShowTime()
{
 var date=new Date();
 var year=date.getFullYear();
 var month=date.getMont ......

javascript ѧϰ1

1.   <script language="LiveScript">
            document.write("ÕâÊÇÒÔ JavaScript Ó¡³öµÄ!")       
      </script>
2.   <script language="LiveScrip ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ