﻿//删除提示
function DelConfirm() {
    return confirm('确定要删除吗?');
}

//获取dtree选中项
function GetDataTreeSelect(id, vid, controlid) {
    var getid = document.getElementById(controlid);
    var checkBoxs = getid.getElementsByTagName('input');
    var checkstr = "";
    var checkvalue = "";
    for (var i = 0; i < checkBoxs.length; i++) {
        if (checkBoxs[i].type == 'checkbox' && checkBoxs[i].checked) {
            checkstr = checkstr + checkBoxs[i].title + ",";
            checkvalue = checkvalue + checkBoxs[i].value + ",";
        }
    }
    if (id != "") {
        document.getElementById(id).value = checkstr.substring(0, checkstr.length - 1);
    }
    if (vid != "") {
        document.getElementById(vid).value = checkvalue.substring(0, checkvalue.length - 1);
    }
}

//取出字符串前后空格
String.prototype.trim = function() {
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

//getElementById简化形式
function $() {
    var elements = new Array();
    for (var i = 0; i < arguments.length; i++) {
        var element = arguments[i];
        if (typeof element == 'string')
            element = document.getElementById(element);
        if (arguments.length == 1)
            return element;
        elements.push(element);
    }
    return elements;
}

//查询
function goSearch(id) {
    var searchInput = $(id).value;
    if (searchInput == "") {
        alert('请输入要搜索的文本！');
        return false;
    }
    window.location.href = "/DHCMS/Search.aspx?searchkeywords=" + searchInput;
}