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

📄 shop.js

📁 javascript语言获取日期时间
💻 JS
字号:
     //开店时的提交验证
	function check_open()
	{		
	    var info = document.getElementById("shopname_info");
	    var value = info.value;
	    if (value.indexOf('已存在')!= -1)
	    {
	        window.alert("该店铺名称已存在,请重新填写!");
	    	return false;
	    }	    
		else if (check_empty('店铺名称','shop_name')||check_empty('店铺地址','shop_address')||check_empty('开始时间','start_time')||check_empty('结束时间','end_time'))
		{
			return false;
		}		
		else if(!check_time("开始时间",document.getElementById("start_time")) || !check_time("结束时间",document.getElementById("end_time")) )
        {
     		return false;
        }
        else if ((!check_select('地区选择',document.getElementById("region"))) || (!check_select('省份选择',document.getElementById("province"))) || (!check_select('城市选择',document.getElementById("city"))))
		{			
			return false;
		}	
        else if (check_empty('联系电话','Contact_phone'))
		{
			return false;
		}
		else
		{	
			disButton('subbutton');			
			document.forms[0].action = "shopOpen.jsp";  
            document.forms[0].submit();            			
			return true;
		}	
	}
	
	//更新店铺信息时的验证
	function check_update()
	{			 
		 if (check_empty('店铺名称','shop_name')||check_empty('店铺地址','shop_address')||check_empty('开始时间','start_time')||check_empty('结束时间','end_time'))
		 {
				return false;
		 }
		 else if(!check_time("开始时间",document.getElementById("start_time")) || !check_time("结束时间",document.getElementById("end_time")) )
         {
     		   return false;
         }
         else if ((!check_select('地区选择',document.getElementById("region"))) || (!check_select('省份选择',document.getElementById("province"))) || (!check_select('城市选择',document.getElementById("city"))))
		 {			
			return false;
		 }	
         else if (check_empty('联系电话','Contact_phone'))
		 {
			return false;
		 }
		 else
		 {	
		 	disButton('subbutton');		
			document.forms[0].action = "shopBasicUpdate.jsp";  
            document.forms[0].submit();			
			return true;
		 }	
	}
	
	//返回上一页面
	function back()
	{		
		window.location.href = "shopDisplay.jsp";
	}

     //修改店铺基本信息
	 function basicModify()
	 {
	    document.forms[0].action = "shopBasicUpIndex.jsp";
	    document.forms[0].submit();   
	 }
	 
	 //修改店铺设计信息
	 function designModidy()
	 {
	 	document.forms[0].action = "designIndex.jsp";
	    document.forms[0].submit();
	 }
	 
	  //修改店铺logo
	 function logoModidy()
	 {
	 	document.forms[0].action = "logoIndex.jsp";
	    document.forms[0].submit();
	 }
	 
	 //修改喜宴酒店的特有信息
	 function wineModify(value)
	 {
	 	document.forms[0].action = "wineIndex.jsp?field_name="+value;
	    document.forms[0].submit();
	 }
	 
	 //回到店铺信息修改界面
	 function backShopDis(shop_id)
	 {
	 	window.location.href = 'shopUpdateIndex.jsp?shop_id='+shop_id;
	 }
	 	
	function checkWine(note,objId,num)
	{
		var obj = document.getElementById(objId);		
		var value = parseInt(obj.value);
		var temp = parseInt(num);
		if (!checkNum(note,objId))
		{
			return false;
		}
		else if (value > temp)
		{
			window.alert(note + "不能大于" +num);
			return false;
		}
		else
		{
			return true;
		}
	}
	
	//提交区域下拉框的值,并在数据库进行查询
	function selectRegion(region,province,city,url)
	{		
	   //获取选中的地区值
	   var sel_region = region.options[region.selectedIndex].value;	   
	   //设置省份的下拉框
	   var province = document.getElementById(province);
	  
	   //创建ajax对象
	   var ajaxobj = new AJAXRequest;  

       ajaxobj.url = url;
       ajaxobj.content="operation=region"+"&region="+sel_region;
       ajaxobj.callback=function(xmlObj) 
       {
       	   var info = xmlObj.responseText;       	   
       	   var pro_info = info.split("|");
       	   var pro_id = pro_info[0].split(",");
       	   var pro_name = pro_info[1].split(",");
       	   province.options.length=0;
		   province.options.length=pro_id.length;       	    
       	   for (var k=0;k<pro_id.length;k++)
       	   {   
       	   	 	   	  
       	   	  if (pro_id[k] != "")
       	   	  {   
       	   	  	province.options[k].value=pro_id[k];
       	   	    province.options[k].text=pro_name[k];       	   	   
       	   	  }       	      
       	   }
       	   selectProvince(province,city,url); 	          	     	     	       
       }
       ajaxobj.send();            
	}
	
	
	//提交省份下拉框的值,并在数据库进行查询
	function selectProvince(province,city,url)
	{
		//获取选中省份的值
		var sel_province = province.options[province.selectedIndex].value;			
		//设置城市的下拉框
		var city = document.getElementById(city);
		 //创建ajax对象
	   var ajaxobj = new AJAXRequest;   

       ajaxobj.url = url;
       ajaxobj.content="operation=province"+"&province="+sel_province;
       ajaxobj.callback=function(xmlObj) 
       {
       	   var info = xmlObj.responseText;        	   	   
       	   var city_info = info.split("|");
       	   var city_id = city_info[0].split(",");
       	   var city_name = city_info[1].split(",");  
       	   city.options.length=0;
		   city.options.length=city_id.length;       	    	   
       	   for (var k=0;k<city_id.length;k++)
       	   {       	   	  
       	   	  if (city_id[k] != "")
       	   	  {      	   	  	
       	   	    city.options[k].value=city_id[k];
       	   	    city.options[k].text=city_name[k];
       	   	  }       	      
       	   }       	     	       
       }
       ajaxobj.send();		
	}

⌨️ 快捷键说明

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