//弹出新窗口
function MyshowModalDialog(url,Parameters,width,height)
{
    if(document.all)
    {
        return window.showModalDialog(url,Parameters,"dialogWidth:"+width+"px;dialogHeight:"+height+"px;edge: Raised; center: Yes; help: no; resizable: no; status: no;");
    }
    else
    {
        var Itop=(window.screen.availHeight-height)/2;
        var Ileft=(window.screen.availWidth-width)/2;
        return window.showModalDialog(url,Parameters,"dialogWidth:"+width+"px;dialogHeight:"+height+"px;dialogLeft:"+Ileft+"px;dialogTop:"+Itop+"px; edge: Raised; center: Yes; help: no; resizable: no; status: no;");
    }
}

   function getimgcode()
        {
             var getimagecode = document.getElementById("getcode");
             getimagecode.src="../validateCode.aspx?id="+Math.round(Math.random()*1000);
             
        }
        
   function preview(oper)
 {
    if (oper < 10)
    {
    bdhtml=window.document.body.innerHTML;//获取当前页的html代码
    sprnstr="<!--startprint"+oper+"-->";//设置打印开始区域
    eprnstr="<!--endprint"+oper+"-->";//设置打印结束区域
    prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+18); //从开始代码向后取html
    prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));//从结束代码向前取html
    window.document.body.innerHTML=prnhtml;
    window.print();
    window.document.body.innerHTML=bdhtml;
    } 
    else
    {
    window.print();
    }
}

//使用很简单 将页面内要打印的内容加入中间<!--startprint1-->XXXXX<!--endprint1-->
//再加个打印按纽 onclick=preview(1) 

