fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.com)</title> <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script> </head> <body> <p id="someElement"></p> <p id="anotherElement"></p> <script> $(function () { var xml = "<rss version='2.0'><channel><title>RSS Title</title></channel></rss>", xmlDoc = $.parseXML( xml ), $xml = $( xmlDoc ), $title = $xml.find( "title" ); // 将 "RSS Title" 附加到 #someElement $( "#someElement" ).append( $title.text() ); // 标题改为 “XML Title” $title.text( "XML Title" ); // 将 "XML Title" 附加到 #anotherElement $( "#anotherElement" ).append( $title.text() ); }) </script> </body> </html>
运行结果