{"id":1591,"date":"2011-04-14T01:00:40","date_gmt":"2011-04-13T17:00:40","guid":{"rendered":"http:\/\/www.zhangxinxu.com\/wordpress\/?p=1591"},"modified":"2018-09-09T13:25:29","modified_gmt":"2018-09-09T05:25:29","slug":"js-range-html%e6%96%87%e6%a1%a3%e6%96%87%e5%ad%97%e5%86%85%e5%ae%b9%e9%80%89%e4%b8%ad%e3%80%81%e5%ba%93%e5%8f%8a%e5%ba%94%e7%94%a8%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/www.zhangxinxu.com\/wordpress\/2011\/04\/js-range-html%e6%96%87%e6%a1%a3%e6%96%87%e5%ad%97%e5%86%85%e5%ae%b9%e9%80%89%e4%b8%ad%e3%80%81%e5%ba%93%e5%8f%8a%e5%ba%94%e7%94%a8%e4%bb%8b%e7%bb%8d\/","title":{"rendered":"JS Range HTML\u6587\u6863\/\u6587\u5b57\u5185\u5bb9\u9009\u4e2d\u3001\u5e93\u53ca\u5e94\u7528\u4ecb\u7ecd"},"content":{"rendered":"<p>by <a href=\"http:\/\/www.zhangxinxu.com\/\">zhangxinxu<\/a> from <a href=\"http:\/\/www.zhangxinxu.com\/\">http:\/\/www.zhangxinxu.com<\/a><br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?p=1591\">http:\/\/www.zhangxinxu.com\/wordpress\/?p=1591<\/a><\/p>\n<style>.selected{background-color:#316AC5; color:#fff;}.pre{margin:5px 0; background:#f5f5f5; border:1px dashed #ccc; padding:5px 10px; word-wrap:break-word; white-space:pre-wrap;  box-shadow:1px 1px 2px rgba(0,0,0,.75);}<\/style>\n<h3>\u4e00\u3001\u524d\u9762\u7684\u4e9b\u8bdd<\/h3>\n<p>\u672c\u6587\u7684\u5185\u5bb9\u57fa\u672c\u4e0a\u662f\u57fa\u4e8e\u201c\u533a\u57df\u8303\u56f4\u5bf9\u8c61(Range objects)\u201d\u8fd9\u4e2a\u6982\u5ff5\u6765\u8bf4\u7684\u3002\u8fd9\u4e2a\u73a9\u610f\uff0c\u53ef\u4ee5\u8ba9\u4f60\u9009\u62e9HTML\u6587\u6863\u7684\u4efb\u610f\u90e8\u5206\uff0c\u5e76\u53ef\u4ee5\u62ff\u8fd9\u4e9b\u9009\u62e9\u7684\u4fe1\u606f\u505a\u4f60\u60f3\u505a\u7684\u4e8b\u60c5\u3002\u5176\u4e2d\uff0c\u6700\u5e38\u89c1\u7684Range\u662f\u7528\u6237\u7528\u9f20\u6807\u9009\u62e9\u7684\u5185\u5bb9(user selection)\u3002<\/p>\n<p>\u672c\u6587\u6709\u4e0d\u5c11\u7bc7\u5e45\u5c31\u662f\u8bb2\u5982\u4f55\u5c06\u7528\u6237\u7684\u8fd9\u79cd\u9009\u62e9\u8f6c\u6362\u4e3a<code>W3C Range<\/code>\u6216<code>Microsoft Text Range\u5bf9\u8c61<\/code>\u3002<\/p>\n<h3>\u4e8c\u3001\u4ec0\u4e48\u662fRange\uff1f<\/h3>\n<p>\u6240\u8c13&#8221;Range&#8221;\uff0c\u662f\u6307HTML\u6587\u6863\u4e2d\u4efb\u610f\u4e00\u6bb5\u5185\u5bb9\u3002\u4e00\u4e2aRange\u7684\u8d77\u59cb\u70b9\u548c\u7ed3\u675f\u70b9\u4f4d\u7f6e\u4efb\u610f\uff0c\u751a\u81f3\u8d77\u59cb\u70b9\u548c\u7ed3\u675f\u70b9\u53ef\u4ee5\u662f\u4e00\u6837\u7684\uff08\u4e5f\u5c31\u662f\u7a7aRange\uff09\u3002\u6700\u5e38\u89c1\u7684Range\u662f\u7528\u6237\u6587\u672c\u9009\u62e9\u8303\u56f4(user text selection)\u3002\u5f53\u7528\u6237\u9009\u62e9\u4e86\u9875\u9762\u4e0a\u7684\u67d0\u4e00\u6bb5\u6587\u5b57\u540e\uff0c\u4f60\u5c31\u53ef\u4ee5\u628a\u8fd9\u4e2a\u9009\u62e9\u8f6c\u4e3aRange\u3002\u5f53\u7136\uff0c\u4f60\u4e5f\u53ef\u4ee5\u76f4\u63a5\u7528\u7a0b\u5e8f\u5b9a\u4e49Range\u3002<\/p>\n<p>\u4f8b\u5982\u4e0b\u9762\u8fd9\u4e2a\u6a21\u6837\u7684\u4f8b\u5b50\uff1a<\/p>\n<pre class=\"pre\">2011-04-12\n\u8d1f\u8d23\u8c03\u67e5\u5207\u5c14\u8bfa\u8d1d\u5229\u6838\u4e8b\u6545\u5bf9\u4eba\u4e0e\u73af\u5883\u9020\u6210\u5f71\u54cd\u7684\u4fc4\u79d1\u5b66\u5bb6\u4e9a\u5e03\u7f57\u79d1\u592b<span class=\"selected\">\u535a\u58eb\u6307\u51fa\uff0c\u56e0\u798f\u5c9b\u6838\u7535\u7ad9\u4f7f\u7528\u7684\u71c3\u6599\u8f83\u5207\u5c14\u8bfa\u8d1d\u5229\u6838\u7535\u7ad9\u591a\uff0c\u4e14\u6709\u53cd\u5e94\u5806\u4f7f\u7528<\/span>\u4e86\u542b\u6709\u9ad8\u6bd2\u6027\u7684\u949a\u7684\u71c3\u6599\uff0c\u56e0\u6b64\"\u798f\u5c9b\u6838\u7535\u7ad9\u4e8b\u6545\u53ef\u80fd\u4f1a\u6bd4\u5207\u5c14\u8bfa\u8d1d\u5229\u5e26\u6765\u66f4\u4e25\u91cd\u7684\u540e\u679c\"\u3002<\/pre>\n<p>\u4e0a\u9762\u9009\u4e2d\u72b6\u6001\u7684\u90a3\u4e9b\u6587\u5b57\u5c31\u53ef\u4ee5\u8f6c\u6362\u6210<code>Range\u5bf9\u8c61<\/code>\uff08\u4e0b\u9762\u4f1a\u8be6\u7ec6\u8bb2\u8ff0\uff09\u3002\u901a\u8fc7<code>Range\u5bf9\u8c61<\/code>\u4f60\u53ef\u4ee5\u627e\u5230Range\u7684\u8d77\u59cb\u70b9\u548c\u7ed3\u675f\u70b9\uff0c\u5982\u679c\u4f60\u5b9e\u5728\u6709\u5fc3\uff0c\u8fd8\u53ef\u4ee5\u5220\u9664\u6216\u662f\u590d\u5236\u8fd9\u4e9b\u5185\u5bb9\uff0c\u6216\u662f\u7528\u5176\u4ed6\u6587\u5b57\u66ff\u6362\uff0c\u751a\u81f3\u662f\u7b80\u5355\u7684HTML\u3002<\/p>\n<p>\u4e0a\u9762\u7684\u4f8b\u5b50\u53ef\u4ee5\u8bf4\u662f\u6700\u7b80\u5355\u7684<code>Range\u5bf9\u8c61<\/code>\u7684\u4f8b\u5b50\uff0c\u56e0\u4e3a\u5176\u53ea\u5305\u542b\u4e86\u6587\u5b57\u3002\u800c\u5b9e\u9645\u4e0a\uff0c<code>Range\u5bf9\u8c61<\/code>\u4e5f\u662f\u53ef\u4ee5\u5305\u542bHTML\u4ee3\u7801\u5185\u5bb9\u7684\uff0c\u4f8b\u5982\u4e0b\u9762\u8fd9\u4e2a\u793a\u4f8b\uff1a<\/p>\n<pre class=\"pre\">&lt;time>2011-04-12&lt;\/time>\n&lt;p>\u636e\u65e5\u672c\u5e7f\u64ad\u534f\u4f1a\u7535\u89c6\u53f012\u65e5\u62a5\u9053\uff0c\u65e5\u672c\u7ecf\u6d4e\u4ea7\u4e1a\u7701\u539f\u5b50\u80fd\u5b89\u5168\u4fdd\u5b89\u9662\u51b3\u5b9a\u5c06\u798f\u5c9b\u7b2c\u4e00\u6838\u7535\u7ad9\u6838\u6cc4\u6f0f\u4e8b\u6545\u7b49\u7ea7\u63d0\u9ad8\u81f37\u7ea7\u3002\u8fd9\u4f7f\u65e5\u672c\u6838<span class=\"selected\">\u6cc4\u6f0f\u4e8b\u6545\u7b49\u7ea7\u4e0e\u82cf\u8054\u5207\u5c14\u8bfa\u8d1d\u5229\u6838\u7535\u7ad9\u6838\u6cc4\u6f0f\u4e8b\u6545\u7b49\u7ea7\u76f8\u540c\u3002&lt;\/p>\n&lt;p>\u8d1f\u8d23\u8c03\u67e5\u5207\u5c14\u8bfa\u8d1d<\/span>\u5229\u6838\u4e8b\u6545\u5bf9\u4eba\u4e0e\u73af\u5883\u9020\u6210\u5f71\u54cd\u7684\u4fc4\u79d1\u5b66\u5bb6\u4e9a\u5e03\u7f57\u79d1\u592b\u535a\u58eb\u6307\u51fa\uff0c\u56e0\u798f\u5c9b\u6838\u7535\u7ad9\u4f7f\u7528\u7684\u71c3\u6599\u8f83\u5207\u5c14\u8bfa\u8d1d\u5229\u6838\u7535\u7ad9\u591a\uff0c\u4e14\u6709\u53cd\u5e94\u5806\u4f7f\u7528\u4e86\u542b\u6709\u9ad8\u6bd2\u6027\u7684\u949a\u7684\u71c3\u6599\uff0c\u56e0\u6b64\"\u798f\u5c9b\u6838\u7535\u7ad9\u4e8b\u6545\u53ef\u80fd\u4f1a\u6bd4\u5207\u5c14\u8bfa\u8d1d\u5229\u5e26\u6765\u66f4\u4e25\u91cd\u7684\u540e\u679c\"\u3002&lt;\/p><\/pre>\n<p>\u540c\u6837\u7684\uff0c<code>Range\u5bf9\u8c61<\/code>\u88ab\u521b\u5efa\uff0c\u4e14\u5305\u542bHTML\uff0c\u73b0\u5728\u7684\u95ee\u9898\u662f\u9009\u62e9\u7684\u5185\u5bb9\u6b63\u597d\u8de8\u8fc7\u4e86\u695a\u6cb3\u548c\u6c49\u754c\uff08\u8de8\u6807\u7b7e\uff09\uff0c\u5982\u679c\u5c31\u5355\u7eaf\u7684\u8bba\u9009\u62e9\u7684\u5185\u5bb9\u7684\u8bdd\uff0c\u5e94\u8be5\u5982\u4e0b\uff1a<\/p>\n<pre class=\"pre\">\u6cc4\u6f0f\u4e8b\u6545\u7b49\u7ea7\u4e0e\u82cf\u8054\u5207\u5c14\u8bfa\u8d1d\u5229\u6838\u7535\u7ad9\u6838\u6cc4\u6f0f\u4e8b\u6545\u7b49\u7ea7\u76f8\u540c\u3002&lt;\/p>\n&lt;p>\u8d1f\u8d23\u8c03\u67e5\u5207\u5c14\u8bfa\u8d1d<\/pre>\n<p>\u663e\u7136\uff0c\u4e0a\u9762\u7684HTML\u5c5e\u4e8e1\u7ea7\u6b8b\u5e9f\uff0c\u57fa\u672c\u65e0\u6548\u3002\u7136\u800c\u5e78\u8fd0\u7684\u662f\uff0c\u6240\u6709\u7684\u6d4f\u89c8\u5668\u90fd\u4f1a\u81ea\u52a8\u8c03\u6574HTML\u7247\u6bb5\u4f7f\u5176\u6709\u6548\uff0c\u5c31\u50cf\u53d8\u6210\u4e0b\u9762\u8fd9\u6837\uff1a<\/p>\n<pre class=\"pre\">&lt;p&gt;\u6cc4\u6f0f\u4e8b\u6545\u7b49\u7ea7\u4e0e\u82cf\u8054\u5207\u5c14\u8bfa\u8d1d\u5229\u6838\u7535\u7ad9\u6838\u6cc4\u6f0f\u4e8b\u6545\u7b49\u7ea7\u76f8\u540c\u3002&lt;\/p&gt;\n&lt;p&gt;\u8d1f\u8d23\u8c03\u67e5\u5207\u5c14\u8bfa\u8d1d&lt;\/p&gt;<\/pre>\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u6d4f\u89c8\u5668\u81ea\u52a8\u8865\u5168\u4e86\u4e00\u5b9a\u6570\u76ee\u7684HTML\u6765\u8ba9Range\u6709\u6548\u3002\u5982\u679c\u4f60\u590d\u5236\u6216\u662f\u79fb\u52a8Range\uff0c\u4f60\u6240\u590d\u5236\u6216\u79fb\u52a8\u7684HTML\u5185\u5bb9\u4e00\u5b9a\u662f\u6709\u6548\u7684\u3002<\/p>\n<h3>\u4e09\u3001\u6d4f\u89c8\u5668\u7684\u517c\u5bb9\u6027<\/h3>\n<p>\u5728\u771f\u6b63\u64cd\u5200JavaScript\u4e4b\u524d\u6211\u4eec\u9700\u8981\u5927\u81f4\u77e5\u9053<code>Range\u5bf9\u8c61<\/code>\u7684\u6d4f\u89c8\u5668\u517c\u5bb9\u6027\u60c5\u51b5\u3002\u5b9e\u9645\u4e0a\uff0c\u95ee\u9898\u662f\u6bd4\u8f83\u9ebb\u70e6\u7684\uff0c\u56e0\u4e3a\u81f3\u5c11\u67093\u79cd<code>\u7c7b\u4f3cRange\u5bf9\u8c61<\/code>\uff0c\u4e14\u4f60\u6709\u5fc5\u8981\u5168\u90e8\u7406\u89e3\u3002\u5148\u5c55\u793a\u8be6\u7ec6\u7684\u517c\u5bb9\u6027\u60c5\u51b5\u8868\uff1a<\/p>\n<p><strong>\u652f\u6301\uff1a<\/strong><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" class=\"vimg\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\"><strong class=\"ml10\">\u4e0d\u652f\u6301\uff1a<\/strong><img decoding=\"async\" src=\"\/study\/image\/error.gif\" class=\"vimg\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\"><strong class=\"ml10\">\u90e8\u5206\u652f\u6301\uff1a<\/strong><img decoding=\"async\" src=\"\/study\/image\/part.gif\" class=\"vimg\" title=\"\u90e8\u5206\u652f\u6301\" alt=\"\u90e8\u5206\u652f\u6301\"><\/p>\n<h5 style=\"font-size:1.06em; margin:0.5em 0;\">1. W3C Range<\/h5>\n<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"params_table\">\n<caption class=\"f11\">\n    <strong>W3C Range<\/strong><br \/>\n  <\/caption>\n<tr>\n<th scope=\"col\">&nbsp;<\/th>\n<th scope=\"col\">Explorer 6\/7<\/th>\n<th scope=\"col\">Firefox 2<\/th>\n<th scope=\"col\">Safari 1.3<\/th>\n<th scope=\"col\">Opera 9<\/th>\n<\/tr>\n<tr>\n<th scope=\"row\">cloneContents()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/part.gif\" title=\"\u90e8\u5206\u652f\u6301\" alt=\"\u90e8\u5206\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">cloneRange()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">collapse()<\/th>\n<td align=\"center\">tbd<\/td>\n<td align=\"center\">tbd<\/td>\n<td align=\"center\">tbd<\/td>\n<td align=\"center\">tbd<\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">collapsed<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">commonAncestorContainer<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">compareBoundaryPoints()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">comparePoint() &#8211; Mozilla \u6269\u5c55<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">createContextualFragment() &#8211; Mozilla \u6269\u5c55<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">deleteContents()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">detach()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">endContainer<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">endOffset<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/part.gif\" title=\"\u90e8\u5206\u652f\u6301\" alt=\"\u90e8\u5206\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">extractContents()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">insertNode()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">isPointInRange() &#8211; Mozilla \u6269\u5c55<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">selectNode()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">selectNodeContents()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">setEnd()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">setEndAfter()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">setEndBefore()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">setStart()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">setStartAfter()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">setStartBefore()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">startContainer<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">startOffset<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/part.gif\" title=\"\u90e8\u5206\u652f\u6301\" alt=\"\u90e8\u5206\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">surroundContents()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<\/table>\n<p><strong>\u8bf4\u660e\uff1a<\/strong><br \/><code>cloneContents()<\/code>\u7684\u7528\u6cd5\u7c7b\u4f3c<code>docFrag = rangeObject.cloneContents()<\/code>\uff0c<code>Range\u5bf9\u8c61<\/code>\u5185\u5bb9\u88ab\u514b\u9686\u540c\u65f6\u88ab\u6dfb\u52a0\u5230\u6587\u6863\u7247\u6bb5\u4e0a\uff0c\u5e76\u8fd4\u56de\u81ea\u8eab\u3002\u4f46\u662f\u5728Safari\u4e0b\u6709\u4e2a\u95ee\u9898\uff0c\u5373\u5982\u679c\u9009\u62e9\u8303\u56f4\u662f\u7a7a\uff0c\u5c06\u4f1a\u8fd4\u56de<code>null<\/code>\u800c\u4e0d\u662f\u7a7a\u7684\u6587\u6863\u7247\u6bb5\u3002\u53ef\u4ee5\u901a\u8fc7\u7c7b\u4f3c<code>docFrag = rangeObject.cloneContents() || document.createDocumentFragment()<\/code>\u8fd9\u6837\u7684\u4ee3\u7801\u4fee\u590d\u3002<\/p>\n<p style=\"padding-top:0;\"><code>deleteContents()<\/code>\u5904\uff0cRange\u5185\u5bb9\u4f1a\u88ab\u6c38\u4e45\u5220\u9664\uff0c\u65e0\u8fd4\u56de\u503c\u3002<\/p>\n<p style=\"padding-top:0;\"><code>endContainer<\/code>\u6307\u7528\u6237\u9009\u62e9\u5185\u5bb9\u7ed3\u5c3e\u5904\u7684\u5bb9\u5668\u8282\u70b9\u3002\u901a\u5e38\u662f\u6587\u672c\u8282\u70b9\u3002<\/p>\n<p style=\"padding-top:0;\"><code>extractContents()<\/code>\u7528\u6cd5<code>docFrag = rangeObject.extractContents()<\/code>\u3002\u4eceDOM\u6811\u4e0a\u526a\u5207<code>Range\u5bf9\u8c61<\/code>\u5e76\u8fd4\u56de\u6587\u6863\u7247\u6bb5\u3002\u8be5\u7247\u6bb5\u53ef\u4ee5\u7c98\u8d34\u5230\u9875\u9762\u4e0a\u3002<\/p>\n<p style=\"padding-top:0;\"><code>startContainer<\/code>\u6307\u7528\u6237\u9009\u62e9\u5185\u5bb9\u8d77\u59cb\u5904\u7684\u5bb9\u5668\u8282\u70b9\u3002\u901a\u5e38\u662f\u6587\u672c\u8282\u70b9\u3002<\/p>\n<p style=\"padding-top:0;\"><code>startOffset<\/code>\u5728Opera\u6d4f\u89c8\u5668\u4e0b\uff0c\u5728\u9009\u62e9\u5185\u5bb9\u4e3a\u7a7a\u7684\u65f6\u5019\u8fd4\u56de<code>0<\/code>\u3002<\/p>\n<h5 style=\"font-size:1.06em; margin:0.5em 0;\">2. Mozilla Selection<\/h5>\n<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"params_table\">\n<caption>\n    <strong>Mozilla Selection<\/strong><br \/>\n  <\/caption>\n<tr>\n<th scope=\"col\">&nbsp;<\/th>\n<th scope=\"col\">Explorer 6\/7<\/th>\n<th scope=\"col\">Firefox 2<\/th>\n<th scope=\"col\">Safari 1.3<\/th>\n<th scope=\"col\">Opera 9<\/th>\n<\/tr>\n<tr>\n<th scope=\"row\">addRange()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">anchorNode<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">anchorOffset<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/part.gif\" title=\"\u90e8\u5206\u652f\u6301\" alt=\"\u90e8\u5206\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">collapse()<\/th>\n<td align=\"center\">tbd<\/td>\n<td align=\"center\">tbd<\/td>\n<td align=\"center\">tbd<\/td>\n<td align=\"center\">tbd<\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">collapseToEnd()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">collapseToStart()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">containsNode()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">deleteFromDocument()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">extend()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">focusNode<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">focusOffset<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/part.gif\" title=\"\u90e8\u5206\u652f\u6301\" alt=\"\u90e8\u5206\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">getRangeAt()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">isCollapsed<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">rangeCount<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">removeAllRanges()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">removeRange()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">selectAllChildren()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">selectionLanguageChange()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<\/table>\n<p><strong>\u8bf4\u660e\uff1a<\/strong><br \/><code>anchorNode<\/code>\u7528\u6cd5\u4e3a<code>userSelection.anchorNode<\/code>\u3002\u6307\u7528\u6237\u9009\u62e9\u5185\u5bb9\u8d77\u59cb\u5904\u7684\u5bb9\u5668\u8282\u70b9\u3002\u901a\u5e38\u662f\u6587\u672c\u8282\u70b9\u3002<\/p>\n<p style=\"padding-top:0;\"><code>anchorNode<\/code>\u5728Opera\u6d4f\u89c8\u5668\u4e0b\uff0c\u5728\u9009\u62e9\u5185\u5bb9\u4e3a\u7a7a\u7684\u65f6\u5019\u8fd4\u56de<code>0<\/code>\u3002<\/p>\n<p style=\"padding-top:0;\"><code>focusNode<\/code>\u7528\u6cd5\u4e3a<code>userSelection.focusNode<\/code>\u3002\u6307\u7528\u6237\u9009\u62e9\u5185\u5bb9\u7ed3\u5c3e\u5904\u7684\u5bb9\u5668\u8282\u70b9\u3002\u901a\u5e38\u662f\u6587\u672c\u8282\u70b9\u3002<\/p>\n<p style=\"padding-top:0;\"><code>focusOffset<\/code>\u5728Opera\u6d4f\u89c8\u5668\u4e0b\uff0c\u5728\u9009\u62e9\u5185\u5bb9\u4e3a\u7a7a\u7684\u65f6\u5019\u8fd4\u56de<code>0<\/code>\u3002<\/p>\n<p style=\"padding-top:0;\"><code>getRangeAt()<\/code>\u7528\u6cd5\u4e3a<code><\/code>rangeObject = userSelection.getRangeAt(0)\uff0c\u4f5c\u7528\u662f\u5c06Mozilla Selection\u8f6c\u6362\u4e3aW3C Range\u3002<\/p>\n<h5 style=\"font-size:1.06em; margin:0.5em 0;\">3. Microsoft TextRange<\/h5>\n<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"params_table\">\n<caption>\n    <strong>Microsoft TextRange<\/strong><br \/>\n  <\/caption>\n<tr>\n<th scope=\"col\">&nbsp;<\/th>\n<th scope=\"col\">Explorer 6\/7<\/th>\n<th scope=\"col\">Firefox 2<\/th>\n<th scope=\"col\">Safari 1.3<\/th>\n<th scope=\"col\">Opera 9<\/th>\n<\/tr>\n<tr>\n<th scope=\"row\">boundingHeight<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">boundingLeft<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">boundingTop<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">boundingWidth<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">collapse()<\/th>\n<td align=\"center\">tbd<\/td>\n<td align=\"center\">tbd<\/td>\n<td align=\"center\">tbd<\/td>\n<td align=\"center\">tbd<\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">compareEndPoints()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">duplicate()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">expand()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">findText()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">htmlText<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">move()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">moveEnd()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">moveStart()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">moveToElementText()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">moveToPoint()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">offsetLeft<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">offsetTop<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">parentElement()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">pasteHTML()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">scrollIntoView()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">select()<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">text<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<\/table>\n<p><strong>\u8bf4\u660e\uff1a<\/strong><br \/><code>htmlText<\/code>\u7528\u6cd5\u4e3a<code>htmlString = userSelection.htmlText<\/code>\u3002\u8fd4\u56de\u5b57\u7b26\u4e32\uff0c\u4e3a<code>TextRange<\/code>\u7684HTML\u5185\u5bb9\uff0c\u76f8\u5f53\u4e8e<code>innerHTML<\/code>\u3002\u53ea\u8bfb\u3002<\/p>\n<p style=\"padding-top:0;\"><code>pasteHTML()<\/code>\uff0c\u5f53\u7c98\u8d34HTML\u5230\u4e00\u4e2a\u6587\u672c\u8282\u70b9\u65f6\uff0c\u8be5\u6587\u672c\u8282\u70b9\u81ea\u52a8\u5206\u9694\u3002<\/p>\n<p style=\"padding-top:0;\"><code>text<\/code>\u7528\u6cd5\u4e3a<code>string = userSelection.text<\/code>\u3002\u8fd4\u56de\u5b57\u7b26\u4e32\uff0c\u4e3a<code>TextRange<\/code>\u7684\u6587\u672c\u5185\u5bb9\uff0c\u76f8\u5f53\u4e8e<code>innerText<\/code>\u3002\u53ef\u8bfb\/\u5199\u3002<\/p>\n<h5 style=\"font-size:1.06em; margin:0.5em 0;\">4. \u603b\u7684\u517c\u5bb9\u6027<\/h5>\n<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"params_table\">\n<caption>\n    <strong>\u603b\u7684\u517c\u5bb9\u6027<\/strong><br \/>\n  <\/caption>\n<tr>\n<th scope=\"col\">&nbsp;<\/th>\n<th scope=\"col\">Explorer 6\/7<\/th>\n<th scope=\"col\">Firefox 2<\/th>\n<th scope=\"col\">Safari 1.3<\/th>\n<th scope=\"col\">Opera 9<\/th>\n<\/tr>\n<tr>\n<th scope=\"row\">W3C Range<\/p>\n<p style=\"padding-top:0;\"><a href=\"http:\/\/www.w3.org\/TR\/2000\/REC-DOM-Level-2-Traversal-Range-20001113\/ranges.html\" style=\"font-weight:normal; text-decoration:underline; font-size:12px;\">\u8be6\u8ff0<\/a><\/p>\n<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">Mozilla Selection<\/p>\n<p style=\"padding-top:0;\"><a href=\"http:\/\/developer.mozilla.org\/en\/docs\/DOM:range\" style=\"font-weight:normal; text-decoration:underline;  font-size:12px;\">\u8be6\u8ff0<\/a><\/p>\n<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/part.gif\" title=\"\u90e8\u5206\u652f\u6301\" alt=\"\u90e8\u5206\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">Microsoft Text Range<\/p>\n<p style=\"padding-top:0;\"><a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/ms535872.aspx\" style=\"font-weight:normal; text-decoration:underline;  font-size:12px;\">\u8be6\u8ff0<\/a><\/p>\n<\/th>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" title=\"\u652f\u6301\" alt=\"\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" title=\"\u4e0d\u652f\u6301\" alt=\"\u4e0d\u652f\u6301\" \/><\/td>\n<td align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/part.gif\" title=\"\u90e8\u5206\u652f\u6301\" alt=\"\u90e8\u5206\u652f\u6301\" \/><\/td>\n<\/tr>\n<\/table>\n<p><strong>\u8bf4\u660e\uff1a<\/strong><\/p>\n<ul id=\"ul\" style=\"margin-top:0; padding-top:0;\">\n<li>W3C Range\u5bf9\u8c61\u662f\u552f\u4e00\u5b98\u65b9\u6307\u5b9a\u3002\u57fa\u672c\u4e0a\u5176\u662f\u5c06Range\u4f5c\u4e3a\u5305\u542bDOM\u7684\u6587\u6863\u7247\u6bb5\u3002<\/li>\n<li>Mozilla Selection\u5bf9\u8c61\u663e\u5f97\u6709\u4e9b\u591a\u4f59\uff0c\u5176\u5b58\u5728\u662f\u4e3a\u4e86\u5411\u540e\u517c\u5bb9Netscape 4\u3002\u5176\u7c7b\u4f3c\u4e8eW3C Range\u5bf9\u8c61\uff0c\u4e5f\u662f\u57fa\u4e8eDOM\u6811\u7684\u3002<\/li>\n<li>Microsoft Text Range\u5bf9\u8c61\u8ddf\u4e0a\u9762\u4e24\u4e2a\u5c31\u662f\u90ed\u5fb7\u7eb2\u548c\u7384\u5f6c\u7684\u533a\u522b\u4e86\uff0c\u56e0\u4e3a\u5176\u662f\u57fa\u4e8e\u5b57\u7b26\u4e32\u7684\u3002\u4e8b\u5b9e\u4e0a\uff0cText Range\u5305\u542b\u7684\u5b57\u7b26\u4e32\u662f\u5f88\u96be\u4e00\u4e0b\u5b50\u8df3\u53d8\u6210DOM\u8282\u70b9\u7684\u3002<\/li>\n<\/ul>\n<p>\u603b\u7684\u6765\u8bf4\uff0cMozilla Selection\u5bf9\u8c61\u5c31\u662f\u4e2a\u6253\u9171\u6cb9\u7684\u547d\uff0c\u4ec5\u6709\u7684\u95ea\u5149\u70b9\u80fd\u591f\u76f4\u63a5\u5c06\u7528\u6237\u9009\u62e9\u4efb\u4f55\u5185\u5bb9\u53d8\u6210\u5b8c\u5168Range\u5bf9\u8c61\u4ee5\u53ca\u4e00\u4e9b\u989d\u5916\u7684\u65b9\u6cd5\u6216\u662f\u5c5e\u6027\u53ef\u4ee5\u5411\u540e\u517c\u5bb9Netscape 4\u3002\u4f46\u662f\u4e0d\u5e78\u7684\u662f\u9664\u4e86IE\u6d4f\u89c8\u5668\u5916\u7684\u5176\u4ed6\u6d4f\u89c8\u5668\u90fd\u652f\u6301\u6b64Selection\u5bf9\u8c61\u3002<\/p>\n<h3>\u56db\u3001\u83b7\u5f97\u7528\u6237\u9009\u62e9\u5185\u5bb9<\/h3>\n<p>\u5a46\u5a46\u5988\u5988\u7684\u89e3\u91ca\u5c31\u514d\u4e86\uff0c\u76f4\u63a5\u770b\u76f8\u5173\u4ee3\u7801\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>var userSelection;\nif (window.getSelection) { <span style=\"color:green;\">\/\/\u73b0\u4ee3\u6d4f\u89c8\u5668<\/span>\n    userSelection = window.getSelection();\n} else if (document.selection) { <span style=\"color:green;\">\/\/IE\u6d4f\u89c8\u5668 \u8003\u8651\u5230Opera\uff0c\u5e94\u8be5\u653e\u5728\u540e\u9762<\/span>\n    userSelection = document.selection.createRange();\n}\n<\/pre>\n<\/div>\n<p>\u7531\u4e8e\u517c\u5bb9\u6027\u7684\u95ee\u9898\uff0cIE\u6d4f\u89c8\u5668\u5403IE\u7684\u5305\u5b50\uff0c\u5176\u4ed6\u6d4f\u89c8\u5668\u5403Mozilla\u7684\u9992\u5934\u3002<\/p>\n<p>\u5728Mozilla\u3001Safari\u3001Opera\u4e0b\u4e0a\u9762\u7684<code>userSelection<\/code>\u662f\u4e2a<code>Selection\u5bf9\u8c61<\/code>\uff0c\u800c\u5728IE\u4e0b\u5219\u662f<code>Text Range\u5bf9\u8c61<\/code>\u3002\u8fd9\u79cd\u5dee\u5f02\u4f1a\u5f71\u54cd\u5230\u4f60\u540e\u9762\u7684\u811a\u672c\uff1aInternet Explorer\u7684<code>Text Ranges<\/code>\u5b8c\u5168\u4e0d\u540c\u4e8eMozilla\u7684<code>Selection<\/code>\u6216\u662fW3C\u7684<code>Range\u5bf9\u8c61<\/code>\uff0c\u4f60\u9700\u8981\u5206\u522b\u4e3aIE\u548c\u5176\u4ed6\u6d4f\u89c8\u5668\u5199\u4e24\u5957\u4e0d\u540c\u7684\u811a\u672c\u3002<\/p>\n<p>\u9700\u8981\u6ce8\u610f\u811a\u672c\u4e66\u5199\u7684\u987a\u5e8f\uff1a<em style=\"font-weight:bold;\">Mozilla Selection\u9700\u653e\u5728\u524d\u9762<\/em>\u3002\u539f\u56e0\u5728\u4e8eOpera\u652f\u6301\u4e24\u79cd\u5bf9\u8c61\uff0c\u5982\u679c\u4f60\u4f7f\u7528<code>window.getSelection()<\/code>\u53bb\u8bfb\u53d6\u7528\u6237\u9009\u62e9\u7684\u5185\u5bb9\uff0cOpera\u4f1a\u521b\u5efa\u4e00\u4e2a<code>Selection\u5bf9\u8c61<\/code>\uff1b\u800c\u4f7f\u7528<code>document.selection<\/code>\u5219\u4f1a\u521b\u5efa\u4e00\u4e2a<code>Text Range\u5bf9\u8c61<\/code>\u3002<\/p>\n<p>\u56e0\u4e3aOpera\u652f\u6301Mozilla Selection\u548cW3C Range\u975e\u5e38\u597d\uff0c\u4f46\u662f\u5176\u5bf9Microsoft Text Range\u7684\u652f\u6301\u5374\u5dee\u5f3a\u4eba\u610f\u3002\u6240\u4ee5\u663e\u7136\u4f18\u5148\u8003\u8651\u6807\u51c6\u6d4f\u89c8\u5668\uff0c\u5373\u4f7f\u7528<code>window.getSelection()<\/code>\u3002<\/p>\n<h3>\u4e94\u3001userSelection\u7684\u5185\u5bb9<\/h3>\n<p><code>userSelection<\/code>\u53d8\u91cf\u73b0\u5728\u7684\u5185\u5bb9\u8981\u4e48\u662fMozilla Selection\u8981\u4e48\u5c31\u662fMicrosoft Text Range\u5bf9\u8c61\u3002\u56e0\u6b64\u5b83\u5141\u8bb8\u8bbf\u95ee\u5b9a\u4e49\u5728\u5bf9\u8c61\u4e0a\u7684\u5168\u90e8\u65b9\u6cd5\u548c\u5c5e\u6027\u3002<\/p>\n<p>Mozilla Selection\u5bf9\u8c61\u5305\u542b\u7528\u6237\u9009\u62e9\u7684\u6587\u672c\u5185\u5bb9\uff0c\u5982\u4e0b\u64cd\u4f5c\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>console.log(userSelection.toString())<\/pre>\n<\/div>\n<p>\u867d\u7136\u683c\u5f0f\u5e76\u4e0d\u662f\u5b57\u7b26\u4e32\uff0c\u4f46\u662f\u5728\u73b0\u4ee3\u6d4f\u89c8\u5668\u4e0b\u8fd8\u662f\u4f1a\u5f39\u51fa\u7c7b\u4f3c\u4e0b\u9762\u7684\u5185\u5bb9\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>\u6cc4\u6f0f\u4e8b\u6545\u7b49\u7ea7\u4e0e\u82cf\u8054\u5207\u5c14\u8bfa\u8d1d\u5229\u6838\u7535\u7ad9\u6838\u6cc4\u6f0f\u4e8b\u6545\u7b49\u7ea7\u76f8\u540c\u3002\u8d1f\u8d23\u8c03\u67e5\u5207\u5c14\u8bfa\u8d1d<\/pre>\n<\/div>\n<p>\u4e3a\u4e86\u4ece<code>Microsoft Text Range \u5bf9\u8c61<\/code>\u4e0a\u83b7\u5f97\u540c\u6837\u7684\u4fe1\u606f\uff0c\u4f60\u9700\u8981\u4f7f\u7528<code>userSelection.text<\/code>\u3002\u4e3a\u4e86\u8bfb\u53d6\u65cb\u8f6c\u7684\u6587\u5b57\uff0c\u53ef\u4ee5\u4f7f\u7528\u7c7b\u4f3c\u4e0b\u9762\u4ee3\u7801\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>var selectedText = userSelection;\nif (userSelection.text) {\n    selectedText = userSelection.text;\n}<\/pre>\n<\/div>\n<p>\u73b0\u5728<code>selectedText<\/code>\u5c31\u5305\u542b\u4e86\u7528\u6237\u6240\u9009\u4e2d\u7684\u6587\u5b57\u4e86\u3002<\/p>\n<p>\u6211\u4eec\u7ec4\u5408\u4e00\u4e0b\uff0c\u5b8c\u6574\u83b7\u53d6\u7528\u6237\u9009\u62e9\u6587\u672c\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre>var userSelection, selectedText = '';\nif (window.getSelection) { <span style=\"color:green;\">\/\/\u73b0\u4ee3\u6d4f\u89c8\u5668<\/span>\n    userSelection = window.getSelection();\n    selectedText = userSelection.toString();\n} else if (document.selection) { <span style=\"color:green;\">\/\/ \u8001IE\u6d4f\u89c8\u5668<\/span>\n    userSelection = document.selection.createRange();\n    selectedText = userSelection.text;\n}<\/pre>\n<p>\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a class=\"a_link\" target=\"_blank\" href=\"\/\/www.zhangxinxu.com\/study\/201104\/get-selection-text.html\">\u83b7\u53d6\u7528\u6237\u6240\u9009\u6587\u5b57demo<\/a><\/p>\n<p>\u4f8b\u5982\u5728IE7\u6d4f\u89c8\u5668\u4e0b\uff0c\u9009\u4e2d\u4e00\u6bb5\u6587\u5b57\u518d\u70b9\u51fbdemo\u9875\u9762\u4e0a\u7684\u6d4b\u8bd5\u6309\u94ae\uff0c\u5c31\u4f1a\u6709\u7c7b\u4f3c\u4e0b\u9762\u7684\u5f39\u51fa\u5185\u5bb9\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201104\/2011-04-13_153812.png\" width=\"473\" height=\"301\" title=\"\u83b7\u53d6\u7528\u6237\u9009\u4e2d\u7684\u6587\u5b57\u622a\u56fe\" alt=\"\u83b7\u53d6\u7528\u6237\u9009\u4e2d\u7684\u6587\u5b57\u622a\u56fe\" \/><\/p>\n<p><strong>input\u8f93\u5165\u6846IE\u4e0b\u9009\u62e9\u6587\u672c\u7684\u83b7\u53d6<\/strong><br \/>\n\u5982\u679c\u662f<code>&lt;input&gt;<\/code>\u6216\u8005<code>&lt;textarea&gt;<\/code>\u8f93\u5165\u6846\uff0c\u5728\u652f\u6301<code>getSelection()<\/code>\u65b9\u6cd5\u7684\u6d4f\u89c8\u5668\u4e2d\uff0c<code>selectedText<\/code>\u503c\u662f\u7a7a\u5b57\u7b26\u4e32\uff0c\u9700\u8981\u4f7f\u7528\u5176\u4ed6\u65b9\u6cd5\u83b7\u53d6\u3002\u5982\u4e0b\uff1a<\/p>\n<pre><span style=\"color:green;\">\/\/ input\u6307\u8f93\u5165\u6846DOM\u5143\u7d20<\/span>\nselectedText = input.value.slice(input.selectionStart, input.selectionEnd);<\/pre>\n<h3>\u516d\u3001\u4eceSelection\u5bf9\u8c61\u521b\u5efaRange\u5bf9\u8c61<\/h3>\n<p>\u5728IE\u6d4f\u89c8\u5668\u4e0b\uff0c<code>userSelection<\/code>\u662f<code>Text Range<\/code>\uff0c\u5728\u73b0\u4ee3\u6d4f\u89c8\u5668\u4e0b\uff0c<code>userSelection<\/code>\u4ecd\u7136\u662f<code>Selection\u5bf9\u8c61<\/code>\uff0c\u8981\u60f3\u540c\u6837\u521b\u5efa\u548c<code>Selection\u5bf9\u8c61<\/code>\u5185\u5bb9\u4e00\u6837\u7684<code>Range\u5bf9\u8c61<\/code>\u53ef\u4ee5\u4f7f\u7528\u7c7b\u4f3c\u4e0b\u9762\u4ee3\u7801\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>var getRangeObject = function(selectionObject) {\n    if (selectionObject.getRangeAt)\n        return selectionObject.getRangeAt(0);\n    else { <span style=\"color:green;\">\/\/ \u8f83\u8001\u7248\u672cSafari!<\/span>\n        var range = document.createRange();\n        range.setStart(selectionObject.anchorNode,selectionObject.anchorOffset);\n        range.setEnd(selectionObject.focusNode,selectionObject.focusOffset);\n        return range;\n    }\n}\nvar rangeObject = getRangeObject(userSelection);\n<\/pre>\n<\/div>\n<p>\u7406\u60f3\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u901a\u8fc7<code>Selection<\/code>\u5bf9\u8c61\u7684<code>getRangeAt()<\/code>\u65b9\u6cd5\u5c31\u53ef\u4ee5\u5f97\u5230<code>W3C Range\u5bf9\u8c61<\/code>\u3002\u6b64\u65b9\u6cd5\u53ef\u4ee5\u8fd4\u56de\u7ed9\u5b9a\u7d22\u5f15\u503c\u7684<code>range\u5bf9\u8c61<\/code>\u3002\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u5728JavaScript\u4e2d\u7b2c\u4e00\u4e2aRange\u7684\u7d22\u5f15\u503c\u662f<code>0<\/code>\u3002<\/p>\n<p><strong>\u4f7f\u7528\u7a0b\u5e8f\u521b\u5efaRange<\/strong><\/p>\n<p>Safari 1.3\u4e0d\u652f\u6301<code>getRangeAt()<\/code>\uff0c\u56e0\u6b64\u6211\u4eec\u8981\u60f3\u517c\u987e\u6b64\u6d4f\u89c8\u5668\uff0c\u9700\u8981\u4f7f\u7528\u5176\u4ed6\u7684\u65b9\u6cd5\u521b\u5efa\u65b0\u7684<code>Range\u5bf9\u8c61<\/code>\u3002\u663e\u7136\uff0c\u663e\u793a\u521b\u5efa\u4e00\u4e2a\u5bf9\u8c61\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>var range = document.createRange();<\/pre>\n<\/div>\n<p>\u4e0a\u9762\u7684\u4e00\u884c\u4ee3\u7801\u521b\u5efa\u4e86\u4e00\u4e2a\u7a7a\u7684Range\uff0c\u4e3a\u4e86\u63d2\u5165\u5185\u5bb9\uff0c\u6211\u4eec\u9700\u8981\u901a\u8fc7<code>setStart()<\/code>\u548c<code>setEnd()<\/code>\u65b9\u6cd5\u5b9a\u4e49\u8d77\u6b62\u70b9\u3002<\/p>\n<p>\u8fd9\u4e24\u4e2a\u65b9\u6cd5\u9700\u8981\u4e24\u4e2a\u53c2\u6570\uff1a<br \/>1. Range\u8d77\u6b62\u7684DOM\u8282\u70b9<br \/>2. Range\u8d77\u6b62\u7684\u6587\u672c\u504f\u79fb\u3002\u8be5\u504f\u79fb\u6307\u9009\u4e2d\u6587\u5b57\u7b2c\u4e00\u4e2a\u5b57\u7b26\u548c\u6700\u540e\u4e00\u4e2a\u5b57\u7b26\u5728\u6587\u672c\u8282\u70b9\u4e2d\u7684\u4f4d\u7f6e\u3002<\/p>\n<p><code>setStart()<\/code>\u7684\u4e24\u4e2a\u53c2\u6570\u5c5e\u6027\u4e3a<code>startContainer<\/code>\u548c<code>startOffset<\/code>\uff1b<code>setEnd()<\/code>\u4e24\u4e2a\u53c2\u6570\u5c5e\u6027\u4e3a<code>endContainer<\/code>\u548c<code>endOffset<\/code>\u3002<\/p>\n<p>\u4ee5\u4e0b\u9762\u8fd9\u4e2a\u4f8b\u5b50\u4e3e\u4f8b\uff1a<\/p>\n<pre class=\"pre\">&lt;p>\u7537\u4eba\uff0c\u5373\u4f7f\u5230\u4e8650\u5c81\uff0c\u4e5f\u5343\u4e07\u4e0d\u8981\u78b0\u8d85\u8fc726\u5c81\u8fd8\u6ca1\u6709\u7ed3\u5a5a\u7684\u5973\u4eba\u3002\u5979\u53ef\u4ee5\u662f\u79bb\u5a5a\uff0c\u4e27\u5076\u7b49\u7b49\u7684\uff0c\u4f46\u662f\u7edd\u5bf9\u4e0d\u80fd\u662f\u6ca1\u6709\u7ed3\u5a5a\u3002\u8d85\u8fc7\u4e8626\u5c81\u6ca1\u6709\u7ed3\u5a5a\uff0c\u8fd9\u79cd\u5973\u4eba\u4e00\u822c\u5fc3\u7406\u53d8\u6001\uff0c\u4e0d\u7136\u5c31\u662f\u6709\u4e25\u91cd\u95ee\u9898\u3002\u5e02\u573a\u5f88\u5c11\u72af\u9519\u3002\u5373\u4f7f\u5b83\u72af\u4e86\u9519\uff0c\u90a3\u88ab\u4f60\u6361\u5230\u5b9d\u7684\u6982\u7387\u4e5f\u5f88\u5c0f\u3002&lt;\/p>\n&lt;p>\u5a5a\u59fb\u5e02\u573a\u672a\u6765\u7684\u53d8<span class=\"selected\">\u5316\u5c06\u4f1a\u662f\u5f88\u6709\u8da3\u7684\u95ee\u9898\uff0c\u800c\u4e14\u5bf9\u672a\u6765\u5927\u9646\u7ecf\u6d4e\u7684\u8d70\u52bf\u4e5f\u6709\u4e3e\u8db3\u8f7b\u91cd\u7684\u5f71\u54cd\uff0c\u5bf9\u4e8e\u884c\u4e1a\u7684\u5206\u5e03\uff0c\u7ecf\u6d4e\u7684\u6574\u4f53\u6548\u7387\u6709\u51b3\u5b9a\u6027\u7684\u5f71\u54cd\u3002&lt;\/p>\n\n&lt;ol>\n    &lt;li>\u4e3a\u4ec0\u4e48\u662f26<\/span>\u8fd9\u4e2a\u51c6\u786e\u7684\u6570\u5b57\uff1f&lt;\/li>\n    &lt;li>\u627e\u9a82\u5e16&lt;\/li>\n    &lt;li>\u8a00\u8bba\u662f\u5bf9\u7684\uff0c\u5728100\u5e74\u524d\uff0clz\u7a7f\u8d8a\u4e86\u800c\u5df2\u3002&lt;\/li>\n&lt;\/ol><\/pre>\n<p>\u6b64\u5904Range\u5f00\u59cb\u4e8e\u7b2c\u4e8c\u4e2a<code>&lt;p&gt;<\/code>\u8282\u70b9\uff0c\u7ed3\u675f\u4e0e\u7b2c\u4e00\u4e2a<code>&lt;li&gt;<\/code>\u8282\u70b9\u3002\uff08\u901a\u5e38\u6587\u672c\u8282\u70b9\u7684\u7b2c\u4e00\u4e2a\u5b57\u7b26\u7684\u7d22\u5f15\u662f<code>0<\/code>\u3002\uff09<\/p>\n<p>\u7531\u4e8e<code>&lt;p&gt;<\/code>\u8282\u70b9\u5904\u7684\u6587\u5b57\u504f\u79fb\u503c\u662f8, <code>&lt;li&gt;<\/code>\u8282\u70b9\u5904\u7684\u504f\u79fb\u662f5\uff0c\u56e0\u800c\u6709\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>var startP = [the p node];\nvar endLi = [the second li node];\nrange.setStart(startP, 8);\nrange.setEnd(endLi, 5);\n<\/pre>\n<\/div>\n<p><strong>\u8bfb\u53d6\u8d77\u6b62\u9009\u4e2d\u5185\u5bb9<\/strong><\/p>\n<p>\u4e0a\u9762\u63d0\u5230\u4e86<code>setStart(startContainer, startOffset)<\/code>\u4ee5\u53ca<code>setEnd(endContainer, endOffset)<\/code>\u3002\u8003\u8651\u5230\u5b9e\u9645\u60c5\u51b5\uff0c\u4f60\u5f88\u96be\u51c6\u786e\u77e5\u9053\u7528\u6237\u9009\u62e9\u7684\u6587\u5b57\u7684\u8d77\u59cb\u4f4d\u7f6e\uff0c\u6240\u4ee5\uff0c\u4e0a\u9762\u4e00\u677f\u4e00\u773c\u8d4b\u4e88\u504f\u79fb\u503c\u7684\u65b9\u6cd5\u663e\u7136\u6709\u5f88\u5927\u7684\u5c40\u9650\u6027\u3002\u597d\u5728\u4efb\u4f55\uff08\u770b\u53c2\u89c1\u4e0a\u9762\u7684\u517c\u5bb9\u6027\u8868\u683c\uff09<code>Range\u5bf9\u8c61<\/code>\u67094\u4e2a\u5c5e\u6027\u662f\u7528\u6765\u5b9a\u4e49\u9009\u62e9\u5185\u5bb9\u8d77\u6b62\u70b9\u7684\uff0c\u8fd94\u4e2a\u5c5e\u6027\u4e0e<code>Selection\u5bf9\u8c61\u76f8\u4f3c<\/code>\uff0c\u4f46\u662f\u5374\u662f\u4e0d\u540c\u7684\u540d\u79f0\uff1a<code>anchorNode\/anchorOffset<\/code>\u5b9a\u4e49\u9009\u62e9\u7684\u8d77\u59cb\uff0c<code>focusNode\/focusOffset<\/code>\u5b9a\u4e49\u7ed3\u675f\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u4e0a\u9762\u7684\u811a\u672c\u521b\u5efa\u9009\u533a\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u4ee3\u7801\u5b9e\u73b0\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>range.setStart(selectionObject.anchorNode,selectionObject.anchorOffset);\nrange.setEnd(selectionObject.focusNode,selectionObject.focusOffset);\n<\/pre>\n<\/div>\n<p><strong>Safari\u7684\u591a\u8651<\/strong><\/p>\n<p>\u73b0\u5728\u5df2\u7ecf\u662f2011\u5e74\u4e86\uff0c\u91ca\u5c0f\u9f99\u90fd\u6709\u7eef\u95fb\u4e86\uff0cSafari 5\u5df2\u7ecf\u51fa\u6765\u597d\u4e9b\u65e5\u5b50\u4e86\u3002\u6240\u4ee5\uff0c\u5982\u679c\u4ec5\u4ec5\u662f\u4e3a\u4e86\u517c\u987e\u4f4e\u7248\u672c\u7684Safari\u800c\u53bb\u4f7f\u7528\u7a0b\u5e8f\u521b\u5efaRange\uff0c\u6211\u89c9\u5f97\u662f\u4e00\u70b9\u5fc5\u8981\u90fd\u6ca1\u6709\u3002\u5c24\u5176\u5728\u6211\u4eec\u8fd9\u4e2a\u795e\u5947\u7684\u56fd\u5ea6\u4e0a\uff0c\u9996\u5148\u4f7f\u7528Safari\u5c31\u5c11\uff0c\u4f4e\u7248\u672c\u7684\u5c31\u5c11\u4e4b\u53c8\u5c11\uff0cSafari\u8001\u65e9\u5c31\u5df2\u7ecf\u652f\u6301<code>getRangeAt()<\/code>\u4e86\uff0cChrome\u6d4f\u89c8\u5668\u4e5f\u662f\u5982\u6b64\u3002<\/p>\n<p>\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a class=\"a_link\" target=\"_blank\" href=\"http:\/\/www.zhangxinxu.com\/study\/201104\/safari-get-range-at-test.html\">Safari\u4e0bgetRangeAt\u6d4b\u8bd5demo<\/a><\/p>\n<p>\u9009\u62e9demo\u9875\u9762\u4e2d\u7684\u4efb\u610f\u4e00\u90e8\u5206\u6587\u5b57\uff0c\u7136\u540e\u70b9\u51fb\u6d4b\u8bd5\u6309\u94ae\uff0c\u5728\u8f83\u65b0\u7248\u672c\u7684Safari\u6d4f\u89c8\u5668\u4e0b\u5c31\u4f1a\u51fa\u73b0\u7c7b\u4f3c\u4e0b\u56fe\u7684\u7ed3\u679c\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201104\/2011-04-13_144100.png\" title=\"Safari\u4e0bgetRangeAt\u5f39\u51fa\" alt=\"Safari\u4e0bgetRangeAt\u5f39\u51fa\" width=\"545\" height=\"400\" \/><\/p>\n<p>\u6240\u4ee5\uff0c\u5728\u5f53\u524d\u73af\u5883\u4e0b\uff0c\u8981\u60f3\u5c06<code>Selection\u5bf9\u8c61<\/code>\u8f6c\u6362\u6210<code>Range\u5bf9\u8c61<\/code>\uff0c\u76f4\u63a5\u5982\u4e0b\u4ee3\u7801\u5c31OK\u4e86(\u5b8c\u6574\u7248)\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>var userSelection, rangeObject;\nif (window.getSelection) { \n    <span style=\"color:green;\">\/\/\u73b0\u4ee3\u6d4f\u89c8\u5668<\/span>\n    userSelection = window.getSelection();\n} else if (document.selection) { \n    <span style=\"color:green;\">\/\/IE\u6d4f\u89c8\u5668 \u8003\u8651\u5230Opera\uff0c\u5e94\u8be5\u653e\u5728\u540e\u9762<\/span>\n    userSelection = document.selection.createRange();\n}\n\n<span style=\"color:green;\">\/\/Range\u5bf9\u8c61<\/span>\nrangeObject = userSelection;\nif (userSelection.getRangeAt) {\n    <span style=\"color:green;\">\/\/\u73b0\u4ee3\u6d4f\u89c8\u5668<\/span>\n    rangeObject = userSelection.getRangeAt(0);\n}<\/pre>\n<\/div>\n<h3>\u4e03\u3001rangy &#8211; JavaScript Range&amp;Selection\u5e93<\/h3>\n<p>\u9879\u76ee\u5730\u5740\uff1a<a href=\"http:\/\/code.google.com\/p\/rangy\/\">http:\/\/code.google.com\/p\/rangy\/<\/a><\/p>\n<p>\u5c31\u5728\u51e0\u5929\u524d\uff0crangy\u66f4\u65b0\u5230\u4e86\u7248\u672c1.1\uff0c\u4f5c\u8005\u8fd8\u65b0\u66f4\u65b0\u4e86\u56db\u4e94\u4e2a\u793a\u610f\u7684\u9875\u9762\uff0c\u5c55\u793a\u4e86\u76f8\u5173\u7684API\uff0c\u65b9\u6cd5\u548c\u5c5e\u6027\u7b49\u3002\u867d\u7136\u5982\u6b64\uff0c\u7531\u4e8e\u5b9e\u4f8b\u8f83\u5c11\uff0c\u8fd8\u662f\u8ba9\u4eba\u5f88\u96be\u77e5\u9053\u6b64JavaScript\u5e93\u5982\u4f55\u4f7f\u7528\u3002\u8fd9\u91cc\u5c31\u4e3e\u51e0\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\u793a\u610f\u4e0b\u3002<span class=\"s\">\/\/zxx:\u6b64\u63d2\u4ef6\u975e\u538b\u7f29\u8fbe115K\uff0c\u4e2a\u4eba\u89c9\u5f97\u6709\u4e9b\u5e9e\u5927\uff0c\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\u7684\u5e94\u7528\u4ef7\u503c\u4e0d\u5927<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/blog\/201104\/2011-04-13_162520.png\" width=\"515\" height=\"87\" \/><\/p>\n<p><strong>\u793a\u4f8b1<\/strong>\uff0c\u83b7\u53d6\u7528\u6237\u9009\u4e2d\u7684\u6587\u5b57\uff1a<\/p>\n<p>\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a href=\"http:\/\/www.zhangxinxu.com\/study\/201104\/rangy-get-selected-text.html\">rangy\u83b7\u53d6\u7528\u6237\u9009\u4e2d\u6587\u5b57demo<\/a><\/p>\n<p>\u9009\u4e2d\u90e8\u5206\u6587\u5b57\u70b9\u51fb\u6309\u94ae\uff0c\u4f1a\u6709\u5982\u4e0b\u5f39\u51fa\uff08\u622a\u81eaFirefox3.6\uff09\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/blog\/201104\/2011-04-13_170536.png\" width=\"495\" height=\"300\" title=\"rangy\u83b7\u53d6\u7528\u6237\u9009\u4e2d\u6587\u5b57\" alt=\"rangy\u83b7\u53d6\u7528\u6237\u9009\u4e2d\u6587\u5b57\" \/><\/p>\n<p>\u76f8\u5173JavaScript\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>var sel = rangy.getSelection();\nalert(sel.toString());\n<\/pre>\n<\/div>\n<p><strong>\u793a\u4f8b2<\/strong>\uff0c\u7ed9\u9009\u4e2d\u6587\u5b57\u6dfb\u52a0\u80cc\u666f<\/p>\n<p>\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a class=\"a_link\" target=\"_blank\" href=\"http:\/\/www.zhangxinxu.com\/study\/201104\/rangy-selected-text-bg.html\">\u6587\u5b57\u9009\u4e2d\u6dfb\u52a0\u80cc\u666f\u56fedemo<\/a><\/p>\n<p>\u9009\u4e2d\u9875\u9762\u4e0a\u4e00\u6bb5\u6587\u5b57\uff0c\u7136\u540e\u5931\u53bb\u7126\u70b9\uff0c\u5c31\u4f1a\u770b\u5230\u6587\u5b57\u540e\u9762\u6709\u4e86\u4e2a\u7f8e\u5973\u80cc\u666f\u56fe\uff0c\u5982\u4e0b\u622a\u56fe\uff0c\u622a\u81eaIE7\u6d4f\u89c8\u5668\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/blog\/201104\/2011-04-13_180343.png\" width=\"424\" height=\"601\" \/><\/p>\n<p>\u5b8c\u6574JavaScript\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;script src=\"\/\/www.zhangxinxu.com\/study\/201104\/rangy\/rangy-core.js\">&lt;\/script>\n&lt;script src=\"\/\/www.zhangxinxu.com\/study\/201104\/rangy\/rangy-cssclassapplier.js\">&lt;\/script>\n&lt;script>\n    var cssApplier;\n    window.onload = function() {\n        rangy.init();\n        cssApplier = rangy.createCssClassApplier(\"selectClass\", true); \n        document.body.onmouseup = function() {\n            cssApplier.toggleSelection();\n        };\n    };\n&lt;\/script><\/pre>\n<\/div>\n<h3>\u516b\u3001\u5b9e\u9645\u7684\u5e94\u7528<\/h3>\n<p><strong>\u5fae\u535a\u4e4b\u63d2\u5165\u8bdd\u9898<\/strong><\/p>\n<p>\u5dee\u4e0d\u591a\u53bb\u5e74\u8fd9\u4e2a\u65f6\u5019\uff0c\u81ea\u5df1\u6298\u817e\u8fc7JS \u6587\u672c\u57df\u5149\u6807\u5904\u6dfb\u52a0\u6587\u5b57\u5e76\u9009\u4e2d\u7684\u5185\u5bb9\uff0c\u4e5f\u662f\u62ff\u7684\u65b0\u6d6a\u5fae\u535a\u793a\u4f8b\u7684\uff0c\u6587\u7ae0\u662f\u201c<a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?p=755\">\u65b0\u6d6a\u5fae\u535a\u63d2\u5165\u8bdd\u9898\u540e\u90e8\u5206\u6587\u5b57\u9009\u4e2d\u7684js\u5b9e\u73b0<\/a>\u201d\uff0c\u4f46\u662f\u53bb\u5e74\u8fd9\u7bc7\u6587\u7ae0\u591a\u5b9e\u73b0\u7684\u8bdd\u9898\u63d2\u5165\u6548\u679c\u662f\u6bd4\u8f83\u5f31\u7684\uff1a<br \/>1. \u9009\u4e2d\u666e\u901a\u6587\u5b57\u4e0d\u80fd\u4f5c\u4e3a\u8bdd\u9898\u63d2\u5165<br \/>2. \u8bdd\u9898\u53ea\u80fd\u63d2\u5728\u6587\u672c\u57df\u6700\u540e\u4e8c\u4e0d\u662f\u5149\u6807\u5904<br \/>3. \u9ed8\u8ba4\u6587\u5b57\u7684\u8bdd\u9898\u53ef\u4ee5\u91cd\u590d\u63d2\u5165<\/p>\n<p>\u6240\u4ee5\uff0c\u8d81\u8fd9\u4e2a\u673a\u4f1a\uff0c\u6b63\u597d\u628a\u5fae\u535a\u4e4b\u63d2\u5165\u8bdd\u9898\u8fd9\u4e2a\u529f\u80fd\u5b8c\u5584\u4e0b\u3002<\/p>\n<p>\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a class=\"a_link\" target=\"_blank\" href=\"http:\/\/www.zhangxinxu.com\/study\/201104\/range-miniblog-insert-topic.html\">\u5fae\u535a\u63d2\u5165\u8bdd\u9898\u7684\u6548\u679c\u5b9e\u73b0demo<\/a><\/p>\n<p>\u6b22\u8fce\u8f93\u5165\u5185\u5bb9\uff0c\u70b9\u51fb\u6d4b\u8bd5\u3002\u5927\u81f4\u4f1a\u6709\u7c7b\u4f3c\u4e0b\u9762\u7684\u6548\u679c(\u622a\u81eaChrome)\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201104\/2011-04-14_003625.png\" width=\"525\" height=\"210\" \/><\/p>\n<p>\u6e90\u4ee3\u7801\u6709\u4e9b\u9ad8\u5ea6\uff0c\u4e3a\u4e86\u8282\u7ea6\u7bc7\u5e45\uff0c\u8fd9\u91cc\u5c31\u4e0d\u5c55\u793a\u51fa\u6765\u4e86\uff0c\u60a8\u53ef\u4ee5\u5728demo\u9875\u9762\u4e2d\u770b\u5230\u5b8c\u6574\u7684CSS\/HTML\/JS\u4ee3\u7801\u3002\u4e0d\u8fc7JS\u90e8\u5206\u534a\u5c01\u88c5\uff0c\u60a8\u8981\u662f\u6709\u5174\u8da3\u53ef\u4ee5\u5728\u5916\u9762\u5305\u88f9\u4e00\u4e2a\u51fd\u6570\u4f7f\u5176\u63d2\u4ef6\u5316\uff0c\u6211\u662f\u61d2\u5f97\u518d\u53bb\u6298\u817e\u4e86\u3002<\/p>\n<h3>\u4e5d\u3001\u7ed3\u8bed\u76f8\u5173<\/h3>\n<p>\u5bf9\u4e8eRange\u76f8\u5173\u7684\u77e5\u8bc6\u5373\u4f7f\u5230\u73b0\u5728\u90fd\u662f\u534a\u751f\u4e0d\u719f\u7684\uff0c\u6240\u4ee5\u6587\u7ae0\u7684\u5185\u5bb9\u66f4\u591a\u7684\u7b97\u662f\u7ffb\u8bd1\u6027\u8d28\u7684\u5185\u5bb9\u3002\u81ea\u5df1\u5e76\u6ca1\u6709\u4ece\u6df1\u5165\u7406\u89e3\u7684\u57fa\u7840\u4e0a\u5f88\u6d45\u663e\u5730\u5256\u6790\u76f8\u5173\u77e5\u8bc6\u70b9\uff0c\u6587\u7ae0\u5f88\u591a\u5730\u65b9\u4f1a\u663e\u5f97\u4e0d\u600e\u4e48\u901a\u4fd7\u6613\u61c2\u3002<\/p>\n<p>\u6587\u4e2d\u591a\u5c55\u793a\u7684Range\u7b49\u517c\u5bb9\u6027\u8868\u683c\u7684\u6570\u636e\u90fd\u662fN\u5e74\u524d\u7684\uff0c\u8fd8\u662fSafari 1.3\u65f6\u4ee3\u7684\u6570\u636e\uff0c\u8001\u7684\u7259\u90fd\u6389\u4e86\uff0c\u5b9e\u7528\u4ef7\u503c\u5927\u6253\u6298\u6263\uff0c\u4e0d\u8fc7\u53ef\u4ee5\u544a\u77e5\u7684\u662f\u5148\u524d\u73b0\u4ee3\u6d4f\u89c8\u5668\u6240\u4e0d\u652f\u6301\u7684\u4e2a\u522b\u5c5e\u6027\u73b0\u65e9\u5c31\u652f\u6301\u4e86\u3002<\/p>\n<p>\u8dcc\u8dcc\u649e\u649e\uff0c\u6eda\u6eda\u722c\u722c\u3002\u6587\u7ae0\u96be\u514d\u6709\u8868\u8ff0\u4e0d\u51c6\u786e\u7684\u5730\u65b9\uff0c\u6b22\u8fce\u6307\u6b63\u3002\u4e5f\u6b22\u8fce\u63d0\u4ea4\u76f8\u5173\u7684\u811a\u672c\u7684bug\u3002<\/p>\n<div class=\"mt10\"><strong>\u53c2\u8003\u6587\u7ae0\u53ca\u76f8\u5173\u9875\u9762\uff1a<\/strong><\/div>\n<ol>\n<li><a href=\"http:\/\/www.quirksmode.org\/dom\/range_intro.html\">Introduction to Range<\/a><\/li>\n<li><a href=\"http:\/\/www.quirksmode.org\/dom\/w3c_range.html\">W3C DOM Compatibility &#8211; Range<\/a><\/li>\n<li><a href=\"http:\/\/code.google.com\/p\/rangy\/\">rangy &#8211; A cross-browser JavaScript range and selection library <\/a><\/li>\n<li><a href=\"http:\/\/css-tricks.com\/reveal-a-background-image-upon-text-selection\/\">Reveal a Background Image upon Text Selection<\/a><\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/emtion\/emoji\/1f603.svg\" width=\"20\" height=\"20\" align=\"absmiddle\"><\/p>\n<p>\u672c\u6587\u4e3a\u539f\u521b\u6587\u7ae0\uff0c\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u6765\u81ea<a href=\"http:\/\/www.zhangxinxu.com\/\">\u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b<\/a>[<a href=\"http:\/\/www.zhangxinxu.com\/\">http:\/\/www.zhangxinxu.com<\/a>]<br \/>\n\u672c\u6587\u5730\u5740\uff1a <a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?p=1591\">http:\/\/www.zhangxinxu.com\/wordpress\/?p=1591<\/a><\/p>\n<p>\uff08\u672c\u7bc7\u5b8c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p><a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?p=1591\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201104\/range.jpg\" class=\"imgpad mb10\" width=\"550\" title=\"\u70b9\u51fb\u67e5\u770b\u672c\u6587\" height=\"170\" \/><\/a><br \/>\n\u672c\u6587\u7684\u5185\u5bb9\u57fa\u672c\u4e0a\u662f\u57fa\u4e8e\u201c\u533a\u57df\u8303\u56f4\u5bf9\u8c61(Range objects)\u201d\u8fd9\u4e2a\u6982\u5ff5\u6765\u8bf4\u7684\u3002\u8fd9\u4e2a\u73a9\u610f\uff0c\u53ef\u4ee5\u8ba9\u4f60\u9009\u62e9HTML\u6587\u6863\u7684\u4efb\u610f\u90e8\u5206\uff0c\u5e76\u53ef\u4ee5\u62ff\u8fd9\u4e9b\u9009\u62e9\u7684\u4fe1\u606f\u505a\u4f60\u60f3\u505a\u7684\u4e8b\u60c5\u3002\u5176\u4e2d\uff0c\u6700\u5e38\u89c1\u7684Range\u662f\u7528\u6237\u7528\u9f20\u6807\u9009\u62e9\u7684\u5185\u5bb9(user selection)\u3002<\/p>\n<p>\u672c\u6587\u6709\u4e0d\u5c11\u7bc7\u5e45\u5c31\u662f\u8bb2\u5982\u4f55\u5c06\u7528\u6237\u7684\u8fd9\u79cd\u9009\u62e9\u8f6c\u6362\u4e3aW3C Range\u6216Microsoft Text Range\u5bf9\u8c61\u3002\u968f\u540e\u5c55\u793a\u4e86Range\u76f8\u5173\u7684JavaScript\u5e93\uff0c\u4ee5\u53caJS \u6587\u672c\u57df\u5149\u6807\u5904\u63d2\u5165\u6587\u5b57\u7684\u5b9e\u73b0\u2014\u2014\u5373\u65b0\u6d6a\u5fae\u535a\u7684\u63d2\u5165\u8bdd\u9898\u529f\u80fd\u7684\u5b8c\u6574\u7248\u5b9e\u4f8b\u5c55\u793a\u3002<\/p>\n<p>\u672c\u6587\u63d0\u4f9b\u5fc5\u8981\u7684\u8868\u683c\u6570\u636e\uff0c\u6e90\u4ee3\u7801\u5c55\u793a\uff0c\u6548\u679c\u622a\u56fe\u4ee5\u53cademo\u9875\u9762\uff0c\u5185\u5bb9\u8f83\u591a\uff0c\u7bc7\u5e45\u8f83\u957f\u3002\u5e0c\u671b\u672c\u6587\u7684\u5185\u5bb9\u80fd\u591f\u5bf9\u60a8\u7684\u5b66\u4e60\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[375,213,587,499,376,140,588,377,349],"_links":{"self":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/1591"}],"collection":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=1591"}],"version-history":[{"count":0,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/1591\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=1591"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=1591"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=1591"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}