几个运用了DWR框架编写的AJAX代码,

源代码在线查看: function.js

软件大小: 2265 K
上传用户: yeshuqin
关键词: AJAX DWR 编写 代码
下载地址: 免注册下载 普通下载 VIP

相关代码

						// JavaScript Document
						
						// 显示菜单  范例:商城首页
						function ShowSubMenu(n,m,k){  //n:对应节点编号,m:子菜单数,k:参数为1 或 0
							if(k==1){
								for(i=1;i									document.getElementById("SubMenu"+i).style.display = "none";
								}
							}else{
								for(i=1;i									document.getElementById("SubMenu"+i).style.display = "none";
								}
								document.getElementById("SubMenu"+n).style.display = "";
							}
						}
						
						// 菜单激活样式  范例:商城首页
						function SelectMenu(n,m,a,f)     // n 菜单序号; m 菜单总数; a 点击后的样式; f 点击前的样式     
						{
							for(var i=1; i							{
								if(document.getElementById('menu'+i)!=null)
								{
									document.getElementById('menu'+i).className = f;
								}
							}
							document.getElementById('menu'+n).className = a;
						//	var node = document.getElementById("SubMenu"+n+"_0");
						//	if(node != null)
						//	{
						//		
						//	}
						}
						
						function SelectSubMenu(n,m,a,f,e){     // n 菜单序号; m 菜单总数; a 点击后的样式; f 点击前的样式  e 名称   
							for(var i=0; i								if(document.getElementById(e+i)!=null)
								{
									document.getElementById(e+i).className = f;
								}
							}
							event.srcElement.className = a;
						}
						
						// 栏目样式激活  范例:注册页面
						function ClickColumn(id){         //id 接收一组 id 值
							var n = ClickColumn.arguments.length;
							for (i=0;i								if(i==0){
									var str = ClickColumn.arguments[i];
									document.getElementById(str).className = "ClickColumn";
								}else{
									var str = ClickColumn.arguments[i];
									document.getElementById(str).className = "ClickColumned";
								}
							}
						}
						
						function ShowManageUpList()
						{
							if(document.getElementById("ManageUpList").style.display == "none")
							{
								document.getElementById("ManageUpList").style.display = "block";
							}
							else
							{
								document.getElementById("ManageUpList").style.display = "none";
							}
						}
						
						function ShowInfo1()
						{
						
						}
						
						function HiddenInfo1()
						{
							
						}
						
						function ShowInfo2()
						{
							
						}
						
						function HiddenInfo2()
						{
							
						}
						
						function winopen(url)
						{
							window.open(url);
						}
						function MM_swapImgRestore() { //v3.0
						  var i,x,a=document.MM_sr; for(i=0;a&&i						}
						function MM_preloadImages() { //v3.0
						  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
							var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i							if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
						}
				
						function MM_findObj(n, d) { //v4.01
						  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
							d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
						  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i						  for(i=0;!x&&d.layers&&i						  if(!x && d.getElementById) x=d.getElementById(n); return x;
						}
				
						function MM_swapImage() { //v3.0
						  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i						   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
						}
						function change_current()
						{
							var _curObj = arguments[0];
							var _tagObj = document.getElementById(arguments[1]);
							getElementsByClass("visible_div")[0].className = "hidden_div";
							_tagObj.className = "visible_div";
							for (var i = 0; i < getElementsByClass("invite_menu").length; i ++)
							{
								if (getElementsByClass("invite_menu")[i].id.indexOf("_hover") > 0)
								{
									getElementsByClass("invite_menu")[i].id = getElementsByClass("invite_menu")[i].id.replace("_hover", "");
								};
							}
							_curObj.id += "_hover";
						}
				function getElementsByClass(searchClass,node,tag) {
					var classElements = new Array();
					if ( node == null )
						node = document;
					if ( tag == null )
						tag = '*';
					var els = node.getElementsByTagName(tag);
					var elsLen = els.length;
					var pattern = new RegExp("(^|\s)"+searchClass+"(\s|$)");
					for (i = 0, j = 0; i < elsLen; i++) {
						if ( pattern.test(els[i].className) ) {
							classElements[j] = els[i];
							j++;
						}
					}
					return classElements;
				}
				
				function add_invite_input_box ()
				{	
					var _tagObj = document.getElementById(arguments[0]);
					var _afterObj = document.getElementById(arguments[1]);
					var inp_name = document.createElement("input");
					var inp_email = document.createElement("input");
					inp_name.setAttribute("name","invite_name[]");
					inp_name.setAttribute("type","text");
					inp_name.setAttribute("className","invite_name");
					inp_email.setAttribute("name","invite_email[]");
					inp_email.setAttribute("type","text");
					inp_email.setAttribute("className","invite_email");
					var _span_col1 = document.createElement("span");
					var _span_col2 = document.createElement("span");
					var _span_col3 = document.createElement("span");
					_span_col1.appendChild(inp_name);
					_span_col2.appendChild(inp_email);
					_span_col1.setAttribute("class","invite_table_col_1");
					_span_col2.setAttribute("class","invite_table_col_2");
					_span_col3.setAttribute("class","invite_table_col_3");	
					_span_col1.setAttribute("className","invite_table_col_1");
					_span_col2.setAttribute("className","invite_table_col_2");
					_span_col3.setAttribute("className","invite_table_col_3");
					_tagObj.insertBefore(_span_col3,_afterObj);
					_tagObj.insertBefore(_span_col1,_afterObj);
					_tagObj.insertBefore(_span_col2,_afterObj);
					//_tagObj.insertBefore(inp_name,null);
				
				}
				function add_friends_input_box ()
				{
					if(document.customInputLength != 0) {
						var _tagObj = document.getElementById(arguments[0]);
						var _afterObj = document.getElementById(arguments[1]);
						var inp_name = document.createElement("input");
						var inp_value = document.createElement("input");
						inp_name.setAttribute("name","friend_left[]");
						inp_name.setAttribute("type","text");
						inp_name.setAttribute("className","friend_intro_left_input");
						inp_value.setAttribute("name","friend_right[]");
						inp_value.setAttribute("type","text");
						inp_value.setAttribute("className","friend_intro_right_input");
						var _li = document.createElement("li");
						_li.appendChild(inp_name);
						_li.appendChild(inp_value);
						_tagObj.insertBefore(_li,_afterObj);
						document.customInputLength --;
					}
					//_tagObj.insertBefore(inp_name,null);
				
				}
				function checkallbox() {
					var _tagObjClassName = arguments[0];
					var _curObj = arguments[1];
					var _tagObjArray = getElementsByClass(_tagObjClassName);
					for (var i = 0; i < _tagObjArray.length; i ++)
					{
						_tagObjArray[i].checked = _curObj.checked;
					}
				}
				
				function replyMsg() {
					var _msg_id = arguments[0];
					var _parentObj = document.getElementById(arguments[1]);
					var _afterObj = document.getElementById(arguments[2]);
					var _uid = arguments[3];
					var _uname = arguments[4];
					var _unickname = arguments[5];
					var _usex = arguments[6];
				
					if(!_parentObj.openReply) {
						var _inp_box = document.createElement("textarea");
						var _title_span = document.createElement("span");
						var _title_link_span = document.createElement("span");
						var _body_span = document.createElement("span");
						var _close_btn = document.createElement("a");
						var _submit_btn = document.createElement("a");
						var _title_span_text = document.createTextNode("回复留言:");
						var _submit_btn_text = document.createTextNode("回复留言");
						_inp_box.setAttribute("className", "reply_input");
						_inp_box.setAttribute("id", "reply_input_" + _msg_id);
						_close_btn.setAttribute("className", "del");
						_close_btn.setAttribute("href", "javascript: removeReplyBox(" + _msg_id + ", '" + arguments[1] + "');");
						
						_submit_btn.setAttribute("className", "BtnBlueF");
						_submit_btn.setAttribute("href", "javascript: submit_ok(reply_input_"+_msg_id+",'"+_uid+"','"+_uname+"','"+_unickname+"','"+_usex+"','"+_msg_id+"');");
						
						
						_title_span.setAttribute("className", "reply_title");
						_title_span.setAttribute("id", "reply_title_" + _msg_id);
						
						_title_link_span.setAttribute("className", "reply_title_link");
						_title_link_span.setAttribute("id", "reply_title_link_" + _msg_id);
						
						_body_span.setAttribute("className", "reply_box");
						_body_span.setAttribute("id", "reply_box_" + _msg_id);
						
						_title_span.appendChild(_title_span_text);
						_title_link_span.appendChild(_close_btn);
						_submit_btn.appendChild(_submit_btn_text);
						_body_span.appendChild(_inp_box);
						_body_span.appendChild(_submit_btn);
						_parentObj.insertBefore(_title_span,_afterObj);
						_parentObj.insertBefore(_title_link_span,_afterObj);
						_parentObj.insertBefore(_body_span,_afterObj);
						_inp_box.focus();
						_parentObj.openReply = true;
					}
					else
					{
						document.getElementById("reply_input_" + _msg_id).focus();
					}
				/*
				            回复留言:
				            
				            回复留言
				*/
				}
				function removeReplyBox() {
					var _msg_id = arguments[0];
					var _parentObj = document.getElementById(arguments[1]);
					_parentObj.removeChild(document.getElementById("reply_title_" + _msg_id));
					_parentObj.removeChild(document.getElementById("reply_title_link_" + _msg_id));
					_parentObj.removeChild(document.getElementById("reply_box_" + _msg_id));
					_parentObj.openReply = false;
					
				}
				function ChangDisplay()
				{
					for(var i=0; i					{
						document.getElementById(arguments[i]).style.display = "none";
					}
					document.getElementById(arguments[0]).style.display = "block";
				}
				function ChangClassName()
				{
					for(var i=0; i					{
						document.getElementById(arguments[i]).className = arguments[arguments.length-2];
					}
					document.getElementById(arguments[0]).className = arguments[arguments.length-1];
				}
				function PrintGetdownMenu()
				{
					var data = new Array();
					data[0] = new Array("MMyIndex.jpg","MMyIndexed.jpg","space/");
					data[1] = new Array("MMyInfo.jpg","MMyInfoed.jpg","/space/index.php?view=personal1");
					data[2] = new Array("MMyCloset.jpg","MMyCloseted.jpg","/space/index.php?action=defaults&view=closet");
					data[3] = new Array("MMyAvatar.jpg","MMyAvatared.jpg","/space/index.php?action=defaults&view=charactor");
					data[4] = new Array("MMyFriend.jpg","MMyFriended.jpg","/space/index.php?action=defaults&view=friends");
					data[5] = new Array("MMyMsg.jpg","MMyMsged.jpg","/channel/index.php?controller=gbook_admin");
					document.write("");
					for(var i=0; i					{
						document.write("");
					}
					document.write("");
				}			

相关资源