246 lines
8.5 KiB
JavaScript
246 lines
8.5 KiB
JavaScript
// JavaScript Document
|
|
|
|
//---------------------------------iframe調整高度---------------------------------------------------
|
|
var getFFVersion = navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
|
|
//extra height in px to add to iframe in FireFox 1.0+ browsers
|
|
var FFextraHeight = getFFVersion >= 0.1 ? 16 : 0
|
|
|
|
function dyniframesize(iframename) {
|
|
var pTar = null;
|
|
if (document.getElementById) {
|
|
pTar = document.getElementById(iframename);
|
|
}
|
|
else {
|
|
eval('pTar = ' + iframename + ';');
|
|
}
|
|
if (pTar && !window.opera) {
|
|
//begin resizing iframe
|
|
pTar.style.display = "block"
|
|
|
|
if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight) {
|
|
//ns6 syntax
|
|
pTar.height = (pTar.contentDocument.body.offsetHeight + FFextraHeight);
|
|
}
|
|
else if (pTar.Document && pTar.Document.body.scrollHeight) {
|
|
//ie5+ syntax
|
|
pTar.height = pTar.Document.body.scrollHeight;
|
|
}
|
|
}
|
|
}
|
|
|
|
//---------------------------------列印---------------------------------------------------
|
|
|
|
function PrintTagData(id) {
|
|
|
|
if (isFirefox = navigator.userAgent.indexOf("Firefox") > 0) {
|
|
window.print();
|
|
} else {
|
|
|
|
var Item = document.getElementById(id);
|
|
var printdetail = window.open("", "TextareaDetail");
|
|
printdetail.document.open();
|
|
printdetail.document.write("<HTML><head><link href=\"../../module/js/css/adminroot.css\" rel=\"stylesheet\" type=\"text/css\">");
|
|
printdetail.document.write("<script type =\"text/javascript\">");
|
|
printdetail.document.write("function mouseover(obj,color_word){obj.style.backgroundColor = color_word;}");
|
|
printdetail.document.write("function mouseout(obj,color_word){obj.style.backgroundColor = color_word;}");
|
|
printdetail.document.write("<\/script>");
|
|
printdetail.document.write("</head>");
|
|
printdetail.document.write("<BODY onload=\"window.print();\"><div style=\"width:720px\">");
|
|
printdetail.document.write(Item.outerHTML);
|
|
printdetail.document.write("</div></BODY></HTML>");
|
|
printdetail.document.close();
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
function PrintTagRWD(id) {
|
|
|
|
if (isFirefox = navigator.userAgent.indexOf("Firefox") > 0) {
|
|
window.print();
|
|
} else {
|
|
|
|
var Item = document.getElementById(id);
|
|
var printdetail = window.open("", "TextareaDetail");
|
|
printdetail.document.open();
|
|
printdetail.document.write("<HTML><head>\n");
|
|
printdetail.document.write('<link href="../../App_Script/bootstrap3/css/bootstrap.css" rel="stylesheet" />\n');
|
|
printdetail.document.write('<link href="../../App_Script/bootstrap_datepicker/css/datepicker.css" rel="stylesheet" />\n');
|
|
printdetail.document.write('<link href="../../admin/skin/css/style.css" rel="stylesheet" media="screen" />\n');
|
|
printdetail.document.write('<link href="../../admin/skin/css/print.css" rel="stylesheet" media="print" />\n');
|
|
printdetail.document.write('<!--[if lt IE 9]>\n');
|
|
printdetail.document.write('<link href="../../admin/skin/css/ie8-and-down.css" rel="stylesheet" type="text/css" />\n');
|
|
printdetail.document.write('<![endif]-->\n');
|
|
|
|
printdetail.document.write("<style type=\"text/css\">.hidden-print{display:none;}</style>");
|
|
printdetail.document.write("</head>");
|
|
printdetail.document.write("<BODY onload=\"window.print();\">");
|
|
printdetail.document.write(Item.outerHTML);
|
|
printdetail.document.write("</BODY></HTML>");
|
|
printdetail.document.close();
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------checkbox全選用---------------------------------------------------
|
|
function Check(parentChk, ChildId) {
|
|
var oElements = document.getElementsByTagName("INPUT");
|
|
var bIsChecked = parentChk.checked;
|
|
|
|
for (i = 0; i < oElements.length; i++) {
|
|
if (IsCheckBox(oElements[i]) &&
|
|
IsMatch(oElements[i].id, ChildId)) {
|
|
oElements[i].checked = bIsChecked;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
function IsMatch(id, ChildId) {
|
|
var sPattern = '^ctl00_ContentPlaceHolder1_Repeater1.*' + ChildId + '$';
|
|
var oRegExp = new RegExp(sPattern);
|
|
if (oRegExp.exec(id))
|
|
return true;
|
|
else
|
|
return false;
|
|
}
|
|
|
|
function IsCheckBox(chk) {
|
|
if (chk.type == 'checkbox') return true;
|
|
else return false;
|
|
}
|
|
|
|
function checkListAll(chk) {
|
|
$('.listCheck input').each(function () {
|
|
this.checked = chk;
|
|
});
|
|
}
|
|
|
|
function checkAll2(chk, num) {
|
|
$('#root_' + num).show();
|
|
$('#root_' + num + ' input:checkbox').each(function () {
|
|
this.checked = chk;
|
|
});
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------按鈕換圖效果---------------------------------------------------
|
|
function MM_preloadImages() { //v3.0
|
|
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
|
|
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
|
|
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
|
|
}
|
|
|
|
function MM_swapImgRestore() { //v3.0
|
|
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
|
|
}
|
|
|
|
function MM_findObj(n, d) { //v4.01
|
|
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
|
|
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
|
|
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
|
|
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
|
|
if(!x && d.getElementById) x=d.getElementById(n); return x;
|
|
}
|
|
|
|
function MM_swapImage() { //v3.0
|
|
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
|
|
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
|
|
|
|
}
|
|
|
|
//---------------------------------選單開合---------------------------------------------------
|
|
function admin_menu_open(oid,scc){
|
|
|
|
beginDate = new Date();
|
|
endDate = new Date();
|
|
endDate.setDate(beginDate.getDate() + 1);
|
|
document.cookie = scc + "menu_oid=" + oid + ";path=/;expires=" + endDate.toUTCString();
|
|
|
|
var imax=parseInt(document.getElementById("admin_menu_max").value);
|
|
for (i=1;i<=imax;i++){
|
|
var m1=document.getElementById("admin_menu_" + i + "_close");
|
|
var m2=document.getElementById("admin_menu_" + i + "_open");
|
|
var m3=document.getElementById("admin_menu_" + i + "_sub");
|
|
if (i==parseInt(oid)){
|
|
m1.style.display="none";
|
|
m2.style.display="block";
|
|
m3.style.display="block";
|
|
}else{
|
|
m1.style.display="block";
|
|
m2.style.display="none";
|
|
m3.style.display="none";
|
|
}
|
|
}
|
|
}
|
|
|
|
//-----------------------------------列表顏色切換------------------------------------------------------
|
|
function mouseover(obj, color_word) {
|
|
obj.style.backgroundColor = color_word; //背景顏色
|
|
}
|
|
|
|
function mouseout(obj, color_word) {
|
|
obj.style.backgroundColor = color_word; //背景顏色
|
|
}
|
|
|
|
|
|
|
|
function mousexy(w) {
|
|
aa = document.body.scrollLeft;
|
|
bb = document.body.scrollTop;
|
|
|
|
|
|
obj = document.getElementById("mview" + w);
|
|
|
|
x01 = posX("mmm" + w) + 125;
|
|
y01 = posY("mmm" + w) - 230;
|
|
//x01 = event.x + aa + 70;
|
|
//y01 = event.y + bb - 160;
|
|
obj.style.display = "block";
|
|
obj.style.top = y01 + "px";
|
|
obj.style.left = x01 + "px";
|
|
|
|
}
|
|
function closeview(w) {
|
|
objx = document.getElementById("mview" + w);
|
|
objx.style.display = "none";
|
|
}
|
|
|
|
function posX(objID) {
|
|
var elmt = document.getElementById(objID);
|
|
var x = 0;
|
|
//繞行 offsetParents
|
|
for (var e = elmt; e; e = e.offsetParent) {
|
|
//把 offsetLeft 值加總
|
|
x += e.offsetLeft;
|
|
}
|
|
//繞行至 document.body
|
|
for (e = elmt.parentNode; e && e != document.body; e = e.parentNode) {
|
|
//減去捲軸值
|
|
if (e.scrollLeft) x -= e.scrollLeft;
|
|
}
|
|
return x;
|
|
}
|
|
|
|
function posY(objID) {
|
|
var elmt = document.getElementById(objID);
|
|
var y = 0;
|
|
//繞行 offsetParents
|
|
for (var e = elmt; e; e = e.offsetParent) {
|
|
//把 offsetTop 值加總
|
|
y += e.offsetTop;
|
|
}
|
|
//繞行至 document.body
|
|
for (e = elmt.parentNode; e && e != document.body; e = e.parentNode) {
|
|
//減去捲軸值
|
|
if (e.scrollTop) y -= e.scrollTop;
|
|
}
|
|
return y;
|
|
}
|