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

📄 comman.js

📁 example for Ajax you can reaserch the code to how to use Ajax
💻 JS
📖 第 1 页 / 共 2 页
字号:
var mag='//////////////////////////////////////////////GTON原创作品-CD管理系统//////////////////////////////////////////////\n'+
        '所用技术:jsp2.0+servlet2.4+jstl1.1+ajax+DOM+proxool+sqlserver2000+tomcat5.5+jbuilder2006\n'+
        '\n'+
        '                                              QQ:27612285\n'+
        '                                              Mail:punkwang@126.com\n'+
        '                                              WEB:www.98202.com www.630cn.com\n'+
        '                                              qq群:20665503\n'+
        '\n'+
        '                                              求高薪工作一个有意者联系本人\n'+
        '                                              Phone:010-81110277(王先生)\n'+
        '';





alert('欢迎加入qq群:20665503');
alert(mag);
//全局变量
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var xmlHttp;
var noPwd='请输入密码';
var noName='请输入用户名';
var noAccPwd="请输入确认密码";
var noPwd2="确认密码和密码不一致";
var nocdName="请输入CD名字";
var nocdCom="请输入CD的发行公司";
var nocdSinger="请输入歌手名字";
var nocdType="请选择CD类型";
var noOldPwd="请输入原始密码";
var noNewPwd="请输入新密码";
var noAccNewPwd="请输入确认新密码";
var newPwd2="新密码和确认密码不一致";
var isRemove='你确定要删除么?';
var isOut="你确定注销么?";
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//公共函数
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function createXMLHttpRequest()
{

	if (window.ActiveXObject)
	{
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if (window.XMLHttpRequest)
	{
		xmlHttp = new XMLHttpRequest();
	}
	 if (xmlHttp.overrideMimeType)
  {
    xmlHttp.overrideMimeType('text/xml');
  }
}

function setQueryString()
{
	var param="";
	for(var i=0;i<arguments.length;i++)
	{
		param+=arguments[i]+'='+encodeURI(arguments[i+1]);
		if(i!=arguments.length-2)
		{
			param+="&";
			i++;
		}else
		{
			break;
		}
		
	}
	return param;
}

function regPage()
{
	options='dialogheight:300px;dialogwidth:250px;edge:raised;center:yes;help:no;resizable:no;status:no;';
	window.showModalDialog("reg.jsp",window,options);
}

function goIndex()
{
	window.navigate('index.jsp');
}

function goLogin()
{
	window.navigate('login.jsp');
}

function goAdd()
{
	window.navigate('add.jsp');
}

function goSelect()
{
	window.navigate('select.jsp');
}

function goChenge()
{
	window.navigate('chenge.jsp');
}

function goEdit(id)
{
	this.id=id;
	options='dialogheight:300px;dialogwidth:250px;edge:raised;center:yes;help:no;resizable:no;status:no;';
	var editForm=window.showModalDialog("edit.jsp",window,options);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//登陆函数
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function check_login(userName,userPwd)
{
	if(userName=='')
	{
			alert(noName);
			return;
	}else if (userPwd=='')
	{
		alert(noPwd);
		return;
	}
	isLogin(userName,userPwd);
}

function isLogin(userName,userPwd)
{
	var param=setQueryString('userName',userName,'userPwd',userPwd);
	createXMLHttpRequest();
	xmlHttp.open('POST','/web/checkservlet',true);
	xmlHttp.setrequestheader("content-type","application/x-www-form-urlencoded");
	xmlHttp.onreadystatechange=loginCallBack;
	xmlHttp.send(param);
}
function loginCallBack()
{
  if(xmlHttp.readyState==4)
	{
		if(xmlHttp.status==200)
		{
          var msg=xmlHttp.responseText;
          alert(msg);
          if(msg.indexOf('成功')!=-1)
          {
          	goIndex();
          }
		}
	}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


//注册函数
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function userReg(userName,userPwd,accPwd)
{
	if(userName=="")
	{
		alert(noName);
		return false;
	}else if(userPwd=="")
	{
		alert(noPwd);
		return false;
	}else if(accPwd=="")
	{
		alert(noAccPwd);
		return false;
	}else if(accPwd!=userPwd)
	{
		alert(noPwd2);
		return false;
	}
	toReg(userName,userPwd);
}
function toReg(userName,userPwd)
{
	var param=setQueryString('userName',userName,'userPwd',userPwd);
	createXMLHttpRequest();
	xmlHttp.open('POST','/web/regservlet',true);
	xmlHttp.setrequestheader("content-type","application/x-www-form-urlencoded");
	xmlHttp.onreadystatechange=regCallBack;
	xmlHttp.send(param);
}
function regCallBack()
{
  if(xmlHttp.readyState==4)
	{
		if(xmlHttp.status==200)
		{
          var msg=xmlHttp.responseText;
          alert(msg);
          if(msg.indexOf('成功')!=-1)
          {
          	window.close();
          }
		}
	}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



//添加CD函数
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function insertCDs(cdName,cdCom,cdSinger,cdType)
{
	if(cdName=="")
	{
		alert(nocdName);
		return false;
	}else if(cdCom=="")
	{
		alert(nocdCom);
		return false;
	}else if(cdSinger=="")
	{
		alert(nocdSinger);
		return false;
	}else if(cdType=="")
	{
		alert(nocdType);
		return false;
	}
	toInsertCD(cdName,cdCom,cdSinger,cdType);
}
function toInsertCD(cdName,cdCom,cdSinger,cdType)
{
	var param=setQueryString('cdName',cdName,'cdCom',cdCom,'cdSinger',cdSinger,'cdType',cdType);
	createXMLHttpRequest();
	xmlHttp.open('POST','/web/addservlet',true);
	xmlHttp.setrequestheader("content-type","application/x-www-form-urlencoded");
	xmlHttp.onreadystatechange=insertCDsCallBack;
	xmlHttp.send(param);
}
function insertCDsCallBack()
{
  if(xmlHttp.readyState==4)
	{
		if(xmlHttp.status==200)
		{
          var msg=xmlHttp.responseText;
          alert(msg);
		}
	}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


//查询分页函数
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var page=1;
var selectValue="";
var pagecount=1;
var action="";
function setPageCount()
{
	var pageTag=document.getElementById('pageCount');
	pagecount=pageTag.innerText=getPageCount();
	document.getElementById('page').innerText=page;
}
function getPageCount()
{
	var res=xmlHttp.responseXML;
	return res.getElementsByTagName('Count')[0].firstChild.nodeValue;
}
function selectCDs(page,action)
{
	this.action=action;
		if(page!=0)
			this.page=page;
		else
			page=1;
		if(page>pagecount)
		{
			this.page=page=pagecount;
		}
		if(action=='last')
		this.page=page=pagecount;
		if(action=='frist')
			this.page=page=1;
	toselectCD(page,action);
}
function toselectCD(page,action)
{
	var param=setQueryString('page',page,'selectValue',selectValue,'action',action);
	createXMLHttpRequest();
	xmlHttp.open('POST','/web/selectservlet',true);
	xmlHttp.setrequestheader("content-type","application/x-www-form-urlencoded");
	xmlHttp.onreadystatechange=selectCDsCallBack;
	xmlHttp.send(param);
}
function selectCDsCallBack()
{
  if(xmlHttp.readyState==4)
	{
		if(xmlHttp.status==200)
		{
			 
          var msg=xmlHttp.responseText;
          clearRestls();
          setHeader();
         setResults();
         setPageCount();
		}
	}
}

⌨️ 快捷键说明

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