netsuite 子标签 tab 显示原理-CarlZeng
function isTabShown(tname) { return document.all[tname+’_div’] == null || document.all[tname+’_div’].style.visibility == ‘visible’; } 用来校验是否显示的状态。 下面这个在IE7中都能兼容: function ShowHideTab(tname,shown) { …
function isTabShown(tname) {
return document.all[tname+’_div’] == null || document.all[tname+’_div’].style.visibility == ‘visible’; }
用来校验是否显示的状态。
下面这个在IE7中都能兼容:
function ShowHideTab(tname,shown) {
if (document.all[tname+’_div’] == null || document.all[tname+’_div’].style.visibility == (shown ? ‘visible’ : ‘hidden’)) return;
document.all[tname+’_div’].style.zIndex = shown ? 2 : -1;
document.all[tname+’_wrapper’].style.zIndex = shown ? 1 : -1;
var machs = allmachs[tname].split(‘,’)
var mach = vismachs[tname]
var dotmachs = ‘’;
if (shown) {
var i
for (i=0;i<machs.length;i++) {
var dotmach = machs[i];
if (dotmach != null && dotmach != mach && document.all[dotmach+’_layer’] != null && document.forms.main_form.elements[dotmach+’dotted’] != null && document.forms.main_form.elements[dotmach+’dotted’].value==’F’)
dotmachs += (dotmachs.length > 0 ? String.fromCharCode(5) : ‘’)+dotmach;
} }
if (shown && mach != null && document.all[mach+’_layer’].style.visibility != ‘hidden’ && document.all[mach+’_layer’].style.display != ‘none’ && document.forms.main_form.elements[mach+’loaded’] != null && document.forms.main_form.elements[mach+’loaded’].value==’F’) refreshmachine(mach, null, true, dotmachs.length > 0 ? dotmachs : null );
else if (shown && dotmachs.length > 0) refreshmachine(null, null, true, dotmachs )
document.images[tname+’lti’].src=document.images[tname+’lti’].src.replace(shown ? /_plain/ : /_stroked/,shown ? ‘_stroked’ : ‘_plain’);
document.images[tname+’rti’].src=document.images[tname+’rti’].src.replace(shown ? /_plain/ : /_stroked/,shown ? ‘_stroked’ : ‘_plain’);
var tabDiv = document.all[tname+’_div’]
tabDiv.style.visibility = shown ? ‘visible’ : ‘hidden’;
tabDiv.style.display = shown ? ‘block’ : ‘none’;
document.all[tname+’lt’].className = shown ? ‘bgontabbottom’ : ‘bgofftabbottom’;
document.all[tname+’lnk’].className = shown ? ‘bgontabbottommid’ : ‘bgofftabbottommid’;
document.all[tname+’rt’].className = shown ? ‘bgontabbottom’ : ‘bgofftabbottom’;
document.all[tname+’txt’].className = shown ? ‘smalltextnolink’ : ‘smallgraytextnolink’;
if(shown) {
document.forms[‘main_form’].elements[‘selectedtab’].value = tname;
tabDiv.className = ‘bgontabbottom’;
if ( mach != null ) sizeLowerTabBGDiv(mach);
}
}