存档
这个函数我觉得还是比较实用的,用于69dns.com的一个新项目。代码有点熟悉?不过这个可是我原创的代码哦。
还有一个控制xml,控制form,控制css,以及加载的boot.js。
当然还有很多东西都不完善,等以后有空的时候,都整理一下。
实际上只是创建了一个stcms的json对象。为了能独立使用加入了if(typeof(stcms)==”undefined”)stcms={};,算是另类的命名空间吧。
/*
文件:ajax.js
挂载:stcms
独立:可独立使用
设计:猫七@69dns.com
*/
(function(){
if(typeof(stcms)==”undefined”)stcms={};
stcms.ajaxstatus=0;
stcms.ajax=function(url,str,method,callback){
if(stcms.ajaxstatus==1){
alert(“请等待上一个进程处理完。”);
return;
}
if(url.indexOf(“?”)!=-1)url+=”&sendTme=”+new Date();else url+=”?sendTme=”+new Date();
var xmlhttpRequest;
if(typeof(xmlhttpRequest!=”object”)){
if(window.ActiveXObject){
try{
xmlhttpRequest = new ActiveXObject(“Microsoft.XMLHTTP”);
}catch(e){
xmlhttpRequest = false;
}
}else if(window.XMLHttpRequest){
xmlhttpRequest = new XMLHttpRequest();
}
}
if(xmlhttpRequest){
stcms.ajaxstatus=1;
xmlhttpRequest.open(method,url,true);
if(method==”post”)xmlhttpRequest.setRequestHeader(“Content-Type”,”application/x-www-form-urlencoded”);
xmlhttpRequest.setRequestHeader(“charset”,”gb2312″);
xmlhttpRequest.onreadystatechange=function(){
if(xmlhttpRequest.readyState==4){
if(xmlhttpRequest.status==200){
callback(xmlhttpRequest.responseText);
stcms.ajaxstatus=0;
}
}
};
xmlhttpRequest.send(str);
}
}
})();
使用方法很简单:
stcms.ajax(‘a.asp’,null,’get’,function(t){alert(t)});
很简单吧。另外发一下我boot.js,我觉得还是比较实用的;
/*
文件:boot.js
挂载:root
功能:加载js
设计:猫七@69dns.com
*/
(function(skin){
var i,ie,d;
stcms={
listen:function(f){
var l;
window.onload=(typeof(l=window.onload)!=’function’)?f:function(){l();f();};
},
$:function(id){
return document.getElementById(id);
}
};
ie=!!((d=(document)).all);
(function(arr){
for(i in arr){
var o=d.createElement(“script”);
o.setAttribute(“type”,”text/javascript”);
o.setAttribute(“src”,arr[i].replace(“stcms.”,”js/”).replace(/\./g,”\/”).replace(“*”,”all”)+”.js”)
d.getElementsByTagName(‘head’)[0].appendChild(o);
}
})([
'stcms.common.client.mouse',
'stcms.common.client.keyboard',
'stcms.skin.'+skin,
'stcms.common.form.form',
'stcms.common.form.grid',
'stcms.common.form.box',
'stcms.common.ajax',
'stcms.common.xml',
'stcms.common.cookie',
'stcms.user.checklogin',
'stcms.control.init'
]);
})(‘default’);
现在boot.js已经实现了皮肤,listen(实际就是window.onload),加载js,通过id获取dom等四个功能。
其他的可能就不太常用的,吧所有的都细分,这样可以减少请求和文件大小哦。
’stcms.common.ajax’,就是上边的ajax.js。
如果有时间,我也准备写个js框剪,集合了所有的功能,哈哈哈。
Test
Test
/*
文件名:set-Object.html
设计者:苗启源
功 能:可以方便的给DOM对象添加方法,可支持所有浏览器
主 页:http://www.miaoqiyuan.cn/p/set-Object
*/
var $=function(id){return document.getElementById(id);}
//SetObject 设置对象属性
var setObject=function(c,d){for(p in d){c[p]=d[p];if(p==”init”)c.init();}return c;}
//扩展属性
var __isIE=function(){return window.ActiveXObject}
var __Name=function(t){if(this.tmp)this.name=this.tmp;else this.name=’Hello’}
var __setClass=function(t){if(__isIE){this.className=t}else{this.setAttribute(‘class’,t);}}
var __getClass=function(){if(__isIE){return this.className}else{return this.getAttribute(‘class’);}}
//测试对象
var ob=$(“Demo”);var ob2=$(“Demo2″);
setObject(ob,{tmp:’Demo’,init:__Name,setClass:__setClass,getClass:__getClass});
setObject(ob2,{init:__Name,setClass:__setClass,getClass:__getClass});
document.write(ob.name+”\n”);
document.write(ob2.name+”\n”);
document.write(ob.getClass()+”\n”);
document.write(ob2.getClass()+”\n”);
ob.setClass(‘newDemoClass’);
ob2.setClass(‘newDemo2Class’);
document.write(ob.getClass()+”\n”);
document.write(ob2.getClass()+”\n”);
因为是两期完成,所有界面有所不同。
详情页面,可以添加站点信息。修改网站状态,添加客户需求。如果已完成网站,添加完需求,自动保存到修改(验收后),否则保存到修改(开发中)。
添加修改业务详情。
另外,还有一个远程调用接口(API),通过JSON传递信息。PHP写的。
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<title>猫七导航</title>
<base target="_blank" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css">
html{background:#666}
h1{margin:0px;text-align:center;font-size:28px;padding:5px 10px;color:#C00}
h2{margin:0px;font-size:16px;padding:5px 10px;color:#060}
body{width:938px;margin:auto;border:solid 5px #000;background:#EEE;padding:20px;margin-top:10px;}
.dh a{margin:0px 5px;text-decoration:none;font-size:12px;color:#000}
.dh a:hover{text-decoration:underline}
dl{width:300px;height:200px;overflow:hidden;float:left;border:solid 1px #000;margin:5px;}
dt{margin:0px;color:#FFF;background:#060;padding:5px;}
/*录入完毕|制作中|等待客户确认|客户确认|修改(开发中)|修改(验收后)*/
.site_0{background:#0000CC;}
.site_1{background:#CCCC00;}
.site_2{background:#00CCCC;}
.site_3{background:#00CC00;}
.site_4{background:#FF0000;}
.site_5{background:#CC0000;}
.site_all{background:#666666}
dt a{color:#FFF;text-decoration:none;font-weight:800;font-size:18px;}
dd{margin:0px;font-size:12px;color:#000;padding:3px;background:#CCC;height:168px;overflow:auto;}
.ColorBox div{padding:5px;margin:5px;float:left;border:solid 1px #000;font-weight:800}
.ColorBox div a{color:#FFF;text-decoration:none}
</style>
</head><body>
< [...]
这几天因为感冒了,工作室的网站一直没有更新。
配合宣传的名片早就印好了,今晚舒服些了,赶快吧网站大体的框架赶出来。很简单,只有一个页面。本来CatSeven.cn的域名挂本博客上的,一不小心,PR到3了。呵呵。现在单独做出来吧~
工作室的网站网址是:http://www.catseven.cn
大体说明了我明年的奋斗目标。08年是浪费了。希望09年能有一个很好的收获。自我感觉还不错。
猫七工作室(CatSeven Studio)
——- 优质服务没有终点,所以我们要不断努力。因为我们坚信:没有最好,只有更好。
随着业务量的增多,客户信息管理又是一个问题,而且客户的资料、画册已经堆积如山了,找一个客户的资料太难了,于是我想到了给客户信息编号,如9月21日跑来的就是9.21-1,9.21-2,把客户在本站的文件名,密码都记录下来。。。噩梦又出现了,今天客户改这,明天改那,记事本已将化的不成样子了
为何不用简单的网站来管理呢?在网上找OA系统?这个太大材小用了吧~因为自己本身就是程序员,还是自己写个吧~
下载地址:http://www.miaoqiyuan.cn/products/sitemanger.rar
通过本程序,可以方便的列出需要拍照的,需要传图的,没有简介的,需要客户确认的,已经完成的单子的信息~
大大的放百年了我们的管理,值得一提的(我最自豪的)是直接点击公司名称即可选中(边框为蓝色),再点取消,通过点击上边的“修改为..”可以批量修改选中的Case的状态(隐藏了checkbox,点击设checkbox设为Ture),不是通过ID来修改,项目可以为任意多,而且可以通过全选,反选来快速选择。
运用了CSS+Javascript+ASP(VBScript),在workeasy系类中我最喜欢的一个工具。