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

📄 pagination.js

📁 这份代码详细的介绍了如果构建struts的分页 如果使用等等 希望你快点通过
💻 JS
字号:
<!--
	var DEBUG = true;
	
	function showInfo(strInfo)
	{
		if(DEBUG)
		{
			alert(strInfo);
		}
	}
	
	function callGoto(totalPageCount,tNumber)
	{
		if(typeof(document.all.tNumber) == 'undefined' || document.all.tNumber.value - 1 < 0)
		{
			document.all.tNumber.value = 1;
		}
		else if(document.all.tNumber.value - totalPageCount > 0)
		{
			document.all.tNumber.value = totalPageCount;
		}

		gotoNumber(document.all.tNumber.value);
	}

	function gotoNumber(number)
	{
		var key = "tNumber";
		var strURL = document.location.href;//当前全网址
		
		strURL = gotoURL(strURL,key,number);
		strURL = gotoURL(strURL,"tQuery",document.all.tQuery.value);
		//showInfo(strURL);
		document.location.href = strURL;
	}

	function gotoURL(strURL,key,value)
	{
		var URL = strURL;//
		if(strURL.indexOf("?") > 0)//获取?之前的网址
		{
			URL = strURL.substring(0,strURL.indexOf("?"));
		}
		//showInfo("strURL:"+ strURL);
		//showInfo("URL:" + URL);
		var strURLBefore = "";
		var strURLAfter = "";
		var strURLResult = "";
		
		if(strURL.indexOf("?") > 0)//如果有?
		{
			if(strURL.indexOf(key) > 0)//如果包含
			{
				//showInfo("Key Position:" + strURL.indexOf(key));
				//showInfo("?+1 Position:" + (strURL.indexOf("?") + 1));
				if(strURL.indexOf(key) > strURL.indexOf("?") + 1)//前面
				{
					strURLBefore = strURL.substring(strURL.indexOf("?") + 1,strURL.indexOf(key) - 1);//Key之前的KeyValue
				}
				//showInfo("strURLBefore:" + strURLBefore);
				strURLAfter = strURL.substring(strURL.indexOf(key) + key.length + 1,strURL.length);//Key后面的Value与其它KeyValue
				//strURL = strURL.substring(0,strURL.indexOf(key) - 1);
				if(strURLBefore != "")
				{
					strURLResult = URL + "?" + strURLBefore + "&" + key + "=" + value;
				}
				else
				{
					strURLResult = URL + "?" + key + "=" + value;
				}
				if(strURLAfter.indexOf("&") >= 0)//如果后面还有
				{
					strURLAfter = strURLAfter.substring(strURLAfter.indexOf("&"),strURLAfter.length);
					strURLResult += strURLAfter;
				}
			}
			else//如果不包含则直接&加之
			{
				strURLResult = strURL + "&" + key + "=" + value;
			}
		}
		else//没有则?之
		{
			strURLResult = strURL + "?" + key + "=" + value;
		}
		//showInfo("strURLResult:" + strURLResult);
		return strURLResult;
	}

	function confirmDeleteByID(URL,id)
	{
		if(confirm("是否确认删除?\t\n"))
		{
			document.location.href = URL + "?method=delete&id=" + id;
		}
	}
	
	function onloadInsert()
	{
		var strURL = document.location.href;
		if(strURL.indexOf("?") > 0)
		{
		}
		else
		{
			document.all.method.value = "insert";
			document.all.name.value = "增加人名";
			document.all.mobile.value = "13800138000";
			document.all.address.value = "增加地址";
			document.all.memo.value = "增加备注";
		}
	}
//-->

⌨️ 快捷键说明

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