<html> <head></head> <body> <form> <div contenteditable>ssadas</div> <mi contenteditable>11</mi><mo>+</mo><mi contenteditable>22</mi> <iframe name="foo" id="foo" src="file:///D:/wamp/www/12.19/1.html"> </iframe> <ul name="ul"> <li name="color">1</li> <li name="color">2</li> <li name="color">3</li> </ul> </form> <form name="bar"> <ol> <li id="cc" name="cc">1</li> <li name="cc">2</li> <li name="cc">3</li> </ol> </form> <script> document.execCommand('bold',false,null); document.execCommand('italic',false,null);document.execCommand('createlink',false,"http://www.xx.com/") //webkit内核的文本选项 document.getSelection(); /* var result = [ anchorNode, anchorOffset, focusNode, focusOffset, //选取终点所在的节点 isCollapsed, rangeCount, //选区内部dom的数量 addRange, //将指定的节点添加到选区 collapse, collapseToENd(), collapseToStart(), containNode( node ),//是否包含节点 deleteFormDocument, //删除 // LIKE AS document.execComand('delete',false,null); extend(node,offset), removeAllRanges(), removeRange(range), selectAllChildren(node), toString() ] */ //主要是扫视了一下高级设计的第十四章:表单脚本的东东,api真多啊 </script> </body> </html>
//打了满满一桶酱油,为什么 document.forms['xx'].elements的内部内容为零,这不对啊