128 lines
4.3 KiB
JavaScript
128 lines
4.3 KiB
JavaScript
|
|
//後台頁面用==================================
|
|
function mouseover(obj, color_word) {
|
|
obj.style.backgroundColor = color_word; //背景顏色
|
|
}
|
|
|
|
function mouseout(obj, color_word) {
|
|
obj.style.backgroundColor = color_word; //背景顏色
|
|
}
|
|
|
|
function MM_preloadImages() { //圖片切換
|
|
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() { //圖片切換
|
|
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) { //圖片切換
|
|
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() { //圖片切換
|
|
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 loadingShow(obj) { //ajax loading
|
|
var position = $(obj).position();
|
|
var ww = $(obj).outerWidth() / 2;
|
|
var hh = $(obj).outerHeight() / 2;
|
|
var w = $('#DivLoading').outerWidth() / 2;
|
|
var h = $('#DivLoading').outerHeight() / 2;
|
|
$('#DivLoading').css('left', (position.left + ww - w) + 'px');
|
|
$('#DivLoading').css('top', (position.top - hh - h) + 'px');
|
|
}
|
|
|
|
|
|
|
|
function showPicBox(obj,div,n,path,w,h) { //圖片預覽顯示
|
|
|
|
if ($('#showPicBox' + n).length) {
|
|
//do something
|
|
}else {
|
|
$('#' + div).append('<div id="showPicBox' + n + '" class="showPicBox" style="width:' + w + 'px; height:' + h + 'px"><img src="../../App_Script/DisplayCut.ashx?file=' + path + '&w=' + w + '&h=' + h + '" /></div>');
|
|
}
|
|
|
|
var position = $(obj).position();
|
|
$('#showPicBox' + n).css('left', (position.left + obj.width) + 'px');
|
|
$('#showPicBox' + n).css('top', (position.top + obj.height - h) + 'px');
|
|
$('#showPicBox' + n).show();
|
|
|
|
}
|
|
|
|
function closePicBox(n) { //圖片預覽關閉
|
|
if ($('#showPicBox' + n).length) {
|
|
$('#showPicBox' + n).hide();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
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=\"../../App_Script/css/admin.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();\">");
|
|
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) {
|
|
|
|
if (id.indexOf(ChildId) > -1) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
function IsCheckBox(chk) {
|
|
if (chk.type == 'checkbox') return true;
|
|
else return false;
|
|
}
|
|
|
|
|