HTML5¼¼Êõ

[H5]range¶ÔÏóÖ®selectNodeµÈ·½·¨ - Aqiaoba

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£ºH5Ö®¼Ò 2017-02-09 11:00 ÎÒÒªÆÀÂÛ( )

¹ØÓÚrange¶ÔÏóµÄ selectNodeContents¡¢selectNode¡¢deleteContents·½·¨ ʾÀý´úÂëÈçÏÂ:!DOCTYPE htmlhtml lang="en"headmeta charset="UTF-8"titleTitle/title/headbodydivÕâÀïÓÐÎÄ×Ö/divinput type="button" value="ɾ³ýÄÚÈÝ"input type="button" value="ɾ

¹ØÓÚrange¶ÔÏóµÄselectNodeContents¡¢selectNode¡¢deleteContents·½·¨ ʾÀý´úÂëÈçÏÂ: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <div>ÕâÀïÓÐÎÄ×Ö</div> <input type="button" value="ɾ³ýÄÚÈÝ"> <input type="button" value="ɾ³ýÔªËØ"> <script> function deleteContent(test) { var div=document.getElementById("div"); var range=document.createRange(); if (test){ range.selectNodeContents(div); range.deleteContents(); }else{ range.selectNode(div); range.deleteContents(); } } </script> </body> </html>

 

¡¡

1.±¾Õ¾×ñÑ­ÐÐÒµ¹æ·¶£¬ÈκÎתÔصĸå¼þ¶¼»áÃ÷È·±ê×¢×÷ÕߺÍÀ´Ô´£»2.±¾Õ¾µÄÔ­´´ÎÄÕ£¬ÇëתÔØʱÎñ±Ø×¢Ã÷ÎÄÕÂ×÷ÕߺÍÀ´Ô´£¬²»×ðÖØÔ­´´µÄÐÐΪÎÒÃǽ«×·¾¿ÔðÈΣ»3.×÷ÕßͶ¸å¿ÉÄܻᾭÎÒÃDZ༭Ð޸Ļò²¹³ä¡£

Ïà¹ØÎÄÕÂ
  • [H5]APIÖ®range¶ÔÏó - Aqiaoba

    [H5]APIÖ®range¶ÔÏó - Aqiaoba

    2017-02-09 10:00

  • html5ѧϰ±Ê¼Ç5--API Range¶ÔÏó(¶þ) - tuohaibei

    html5ѧϰ±Ê¼Ç5--API Range¶ÔÏó(¶þ) - tuohaibei

    2016-08-18 15:00

  • html5ѧϰ±Ê¼Ç4--API Range¶ÔÏó(Ò») - tuohaibei

    html5ѧϰ±Ê¼Ç4--API Range¶ÔÏó(Ò») - tuohaibei

    2016-08-15 10:00

ÍøÓѵãÆÀ
À