日期:2014-05-16  浏览次数:20410 次

data-value的值应该如何获取?
添加列表项
C/C++ code

if (m_bFirstLi)
    {
        m_cstrExternInfo += _T("<li class=\"extern-sel\" data-value=\"");
    }
    else
    {
        m_cstrExternInfo += _T("<li class=\"extern-notsel\" data-value=\"");
    }
    m_bFirstLi = FALSE;
    m_cstrExternInfo += cstrMsg;
    m_cstrExternInfo += _T("\"><a href=\"#\"><span>");
    m_cstrExternInfo += cstrMsg;
    m_cstrExternInfo += _T("</span></a></li>");



获取列表数据
JScript code

var strXML="";
    function showNode(dltable) {
        for(var i = 0; i < dltable.length; i++)
        {
            if (dltable[i].nodeType == 1) {
                if (dltable[i].nodeName == "dt" || dltable[i].nodeName == "DT") {
                    strXML += "<pfield fname=\"";
                    strXML += dltable[i].innerHTML;
                    strXML += "\" ";
                }
                if (dltable[i].nodeName == "li" || dltable[i].nodeName == "LI") {
                    if(dltable[i].className == "extern-sel"){
                        strXML += "fvname=\"";
                        strXML += dltable[i].dataset.value;
                        strXML += "\" >";
                        break;
                    }
                }
                if (dltable[i].childNodes.length > 0) {
                    showNode(dltable[i].childNodes);
                }
           }
       }
    }

        var dltable = document.getElementById("infolist").childNodes;

        showNode(dltable);



dataset.value这个取不到是什么原因?

------解决方案--------------------
dataset是什么,某个节点的自定义属性?