[JavaScript] jQuery分下xml数据的代码 →→→→→进入此内容的聊天室

来自 , 2019-07-02, 写在 JavaScript, 查看 117 次.
URL http://www.code666.cn/view/f04b8b59
  1. //      The example XML is as follows:
  2.         //      <links><link title="Jo's Birthday" link="/media/DiaryDocs/2012/9/25/Jo Holiday.jpg" type="internal" newwindow="1" repository="Local Site Path" /></links>
  3.  
  4.         var _filedisplay = '';
  5.     var _title;
  6.     var _url;
  7.     var _filexml = eventdialogjs.currentCalEventDetailObj.eventFiles;
  8.     if (_filexml.length > 0) {
  9.         $(_filexml).find('link').each(function () {
  10.             $.each(this.attributes, function (i, attrib) {
  11.                 if (attrib.name == 'title') {
  12.                     _title = attrib.value;
  13.                 }
  14.                 if (attrib.name == 'link') {
  15.                     _url = attrib.value;
  16.                 }
  17.             });
  18.             _filedisplay += '<a href="' + _url + '" target="_blank">' + _title + '</a> ';
  19.             console.log('Files: ', _filedisplay);
  20.         });
  21.         $('#file-list').html(_filedisplay);
  22.     }
  23. //javascript/5286

回复 "jQuery分下xml数据的代码"

这儿你可以回复上面这条便签

captcha