0

我搜索拖放到列脚本,我找到了这个

http://www.dhtmlgoodies.com/index.html?showDownload=true&whichScript=drag_drop_nodes

我尝试在我移动的项目上添加突出显示的颜色

我添加css代码

<style type="text/css">
.highlight {
    background-color: #fff34d;
}
</style>

并在JavaScript中修改它

    function initDragDropScript() {
        dragContentObj = document.getElementById('dragContent');
        dragDropIndicator = document.getElementById('dragDropIndicator');
        dragDropTopContainer = document.getElementById('dhtmlgoodies_dragDropContainer');
        document.documentElement.onselectstart = cancelEvent;;
        var listItems = dragDropTopContainer.getElementsByTagName('LI'); // Get array containing all <LI>
        listItems.className = 'highlight';
        var itemHeight = false;
        for (var no = 0; no < listItems.length; no++) {
            listItems[no].onmousedown = initDrag;
            listItems[no].onselectstart = cancelEvent;
            if (!itemHeight) itemHeight = listItems[no].offsetHeight;
            if (MSIE && navigatorVersion / 1 < 6) {
                listItems[no].style.cursor = 'hand';
            }
        }
        var mainContainer = document.getElementById('dhtmlgoodies_mainContainer');
        var uls = mainContainer.getElementsByTagName('UL');
        itemHeight = itemHeight + verticalSpaceBetweenListItems;
        for (var no = 0; no < uls.length; no++) {
            uls[no].style.height = '480 px';
        }

        var leftContainer = document.getElementById('dhtmlgoodies_listOfItems');
        var itemBox = leftContainer.getElementsByTagName('UL')[0];
        document.documentElement.onmousemove = moveDragContent; // Mouse move event - moving draggable div 
        document.documentElement.onmouseup = dragDropEnd; // Mouse move event - moving draggable div 
        var ulArray = dragDropTopContainer.getElementsByTagName('UL');
        for (var no = 0; no < ulArray.length; no++) {
            ulPositionArray[no] = new Array();
            ulPositionArray[no]['left'] = getLeftPos(ulArray[no]);
            ulPositionArray[no]['top'] = getTopPos(ulArray[no]);
            ulPositionArray[no]['width'] = ulArray[no].offsetWidth;
            ulPositionArray[no]['height'] = ulArray[no].clientHeight;
            ulPositionArray[no]['obj'] = ulArray[no];
        }

        if (!indicateDestionationByUseOfArrow) {
            indicateDestinationBox = document.createElement('LI');
            indicateDestinationBox.id = 'indicateDestination';
            indicateDestinationBox.style.display = 'none';
            document.body.appendChild(indicateDestinationBox);
        }
    }

但它没有任何建议

4

0 回答 0