﻿//document.onselectstart=function(){return false;}
////（2）屏蔽右键菜单
//document.oncontextmenu=function(){return false;}
////（3）另一种屏蔽右键菜单
//document.onmousedown=function(){
//if(event.button==2)return false;
//} 


//复选框全选/全不选
//当ischecked为true时全选，ischeck为false时全不选
function changeCheckbox(ischecked)
{
    //获取页面全部标签名为"input"的元素
    var checkboxes = document.getElementsByTagName("input");
    for(var i = 0; i < checkboxes.length; i++)
    {
        //如果是"checkbox"
        if(checkboxes[i].type == "checkbox")
        {
            //设置选/不选
            checkboxes[i].checked = ischecked;
        }
    }
}

//按区域，复选框全选/全不选
//areaid是区域id
//当ischecked为true时全选，ischeck为false时全不选
function changeCheckboxByArea(areaid,ischecked)
{
    //获取区域
    var area = document.getElementById(areaid);
    //获取区域内标签名为"input"的元素
    var checkboxes = area.getElementsByTagName("input");
    for(var i = 0; i < checkboxes.length; i++)
    {
        //如果是"checkbox"
        if(checkboxes[i].type == "checkbox")
        {
            //设置选/不选
            checkboxes[i].checked = ischecked;
        }
    }
}
//删除时确认
//如果没有选中则弹出警告
function showdelete(){
//获取页面全部标签名为"input"的元素
    var checkboxes = document.getElementsByTagName("input");
    var num=0;
    for(var i = 0; i < checkboxes.length; i++)
    {
        //如果是"checkbox"
        if(checkboxes[i].type == "checkbox")
        {
            if (checkboxes[i].checked==true)
                num=num+1;
        }
    }
    if(num>0)
    {
         return confirm("确定要删除吗？"); //设置选/不选
    }      
    else
    {
        alert("先请选择后再删除！");
        return false;
    }
}


function show(url,width,height)
{
    //window.showModalDialog(url,"dialog",'dialogWidth='+width+'px;dialogHeight='+height+'px;center:yes;help=no;resizable:no;status:no;scroll=auto;menubar=no;titlebar=no;toolbar=no');//help=no;resizable:no;status:no;scroll=auto;menubar=no;titlebar=no;toolbar=no
    var ret=window.showModalDialog(url,"dialog",'dialogWidth='+width+'px;dialogHeight='+height+'px;center:yes;help=no;resizable:no;status:no;scroll=auto;menubar=no;titlebar=no;toolbar=no');//help=no;resizable:no;status:no;scroll=auto;menubar=no;titlebar=no;toolbar=no
    if(ret == 1) 
    { 
          window.location.reload();//本页刷新
    }
}
function pageopen(url,width,height,title,x,y) {
window.open(''+url,title,'top='+x+',left='+y+',width='+width+',height='+height+',status=no,resizable=auto,scrollbars=yes');
}
function pageopenscrollbars(url,width,height,title,x,y) {
window.open(''+url,title,'top='+x+',left='+y+',width='+width+',height='+height+',status=no,resizable=auto,scrollbars=yes');
}
