一半,一半

[ 不指定 2008/11/18 16:14 | by wxxslt ]
差不多了,才大二上学期。
想一想,现在还什么东西不懂呢?
推荐一本书《Javascript&Ajax应用开发》
这本书真是不错,看了200多页了,不到一周时间,神了……书上的例子都很不错,不过……有些地方有点小错误,08年9月份才出的第一版,体谅下。
总想找个时间放松下,感觉时间真的很充裕。大二结束:PHP&Js&Ajax不知道能不成实现呢,我想:真的差不多了……现在还缺的一个东西是:experience,不熟悉。

运动会去找下我的启蒙老师——Else,哈哈,老朋友了。希望能懂多点的东西。
shy

三个很有用的正则

[ 不指定 2008/11/14 20:31 | by wxxslt ]
1、/^\S+@\S+\.\S+$/  用于E-mail验证
2、/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/

用于IP地址验证

3、/^\d{17}(\d|X)$/  身份证验证

JS实现:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml...
<html xmlns="http://www.w3.org/1999/xht...
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>验证身份证号码</title>
<script type="text/javascript">
//建立存在地址码及地址名称的数组
var aCity={11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古"
      ,21:"辽宁",22:"吉林",23:"黑龙江 ",31:"上海",32:"江苏"
      ,33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南"
      ,42:"湖北 ",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆"
      ,51:"四川",52:"贵州",53:"云南",54:"西藏 ",61:"陕西",62:"甘肃"
      ,63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外 "
      }
function checkCard(cardId){
  var iSum = 0;
  var re = /^\d{17}(\d|X)$/i;
  if(!re.test(cardId)){
    return false;
  }
  cardId = cardId.replace(/X$/i,"a");
  //验证地址码是否合法
  if(aCity[parseInt(cardId.substr(0,2))] == null){
    alert('地址非法!');
    return false;
  }
  //验证出生日期码是否合法
  sBirthday = cardId.substr(6,4)+"-"+Number(cardId.substr(10,2))+"-"+Number(cardId.substr(12,2));
  var date = new Date(sBirthday.replace(/-/g,"/"));
  if(sBirthday!=(date.getFullYear()+"-"+ (date.getMonth()+1) + "-" + date.getDate())){
    alert('出生日期非法!');
    return false;
  }
  //验证检验码是否合法
  for(var i = 17;i>=0;i--){
    iSum += (Math.pow(2,i) % 11) * parseInt(cardId.charAt(17 - i),11);
  }
  if(iSum%11!=1){
    alert("校验码非法!");
    return false;
  }
  alert('地址:'+aCity[parseInt(cardId.substr(0,2))] + "\n"
         + "出生日期:" +sBirthday + "\n"
         + "性别:" + (cardId.substr(16,1)%2?"男":"女"));
}
</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
  <label>请输入身份证号码:

  

  <input name="card" type="text" id="card" maxlength="19" />
  </label>
  <p>
    <label>
    <input type="button" name="Submit" value="确定" onclick='checkCard(this.form.card.value)'/>
    </label>
    <label>
    <input type="reset" name="Submit2" value="重置" />
    </label>
  </p>
</form>
</body>
</html>

通过session禁用页面刷新

[ 不指定 2008/11/07 21:54 | by wxxslt ]
<?php session_start(); ?>
<title>通过session禁用页面刷新</title>
<style type="text/css">
<!--
body,td,th {
font-size: 12px;
}
-->
</style>
<center>
<?php
  if($_SESSION[temp]==""){
   if(($fp=fopen("count.txt","r"))==false){
    echo "打开文件失败!";
      }else{
    $counter=fgets($fp,1024);      //读取文件中数据
       fclose($fp);                        //关闭文本文件
       $counter++;                         //计数器增加1
       $fp=fopen("count.txt","w");       //以写的方式打开文本文件
    fputs($fp,$counter);                //将新的统计数据增加1
       fclose($fp);      //关闭文件
   }                    
         if(($fp=fopen("count.txt","r"))==false){
    echo "打开文件失败!";
   }else{
          $counter=fgets($fp,1024);
          fclose($fp);
             echo "数字计数器: " .$counter ;    //输出访问次数
   }
     $_SESSION[temp]=1;  //登录以后,$_SESSION[temp]的值不为空,给$_SESSION[temp]赋一个值1
   }else{
     echo "<script>alert('您不可以刷新本页!!'); history.back();</script>";
   if(($fp=fopen("count.txt","r"))==false){
    echo "打开文件失败!";
   }else{
    $counter=fgets($fp,1024);
    fclose($fp);
    echo "网页访问量: " .$counter ;   //输出访问次数
   }
    }
?>
</center>
Tags: ,

一个分页类

[ 不指定 2008/11/01 22:28 | by wxxslt ]
class page
{
    private $pagesize;
private $page;
private $pagecount;
private $total;
private $conn;
    
public function __construct($pagesize,$page)
{
    $this->pagesize=$pagesize;
    $this->page=$page;

}

public function listInfo()
{
    if($this->page=="" || !is_numeric($this->page))
     {
       $this->page=1;
     }
    
    $this->conn=mysql_connect("localhost","root","lwm");
    mysql_select_db("m_students",$this->conn);
       mysql_query("set names gb2312");  
    $sql=mysql_query("select count(*) as total from tb_student",$this->conn);
    $info=mysql_fetch_array($sql);
    $this->total=$info[total];
    if($this->total==0)
    {
      
   echo "<table width=704 height=20 border=0 align=center cellpadding=0 cellspacing=0>"+
               "<tr>"+
                "<td><div align=center>暂无学生信息!</div></td>"+
               "</tr>"+
              "</table>";
    
    }
    else
    {
    if(($this->total % $this->pagesize)==0)
     {
    $this->pagecount=intval($this->total/$this->pagesize);
  
  }
  else
  {
    if($this->total<=$this->pagesize)
    {
      $this->pagecount=1;
    }
    else
    {
       $this->pagecount=ceil($this->total/$this->pagesize);
    }
  
  }
  
  $sql=mysql_query("select * from tb_student order by sno desc limit ".$this->pagesize*($this->page-1).",$this->pagesize",$this->conn);
  
       ?>
    
    <table width="703" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#4C6404">
        <tr>
         <td width="100" height="20" bgcolor="#C2C41F"><div align="center">学号</div></td>
         <td width="100" bgcolor="#C2C41F"><div align="center">姓名</div></td>
         <td width="100" bgcolor="#C2C41F"><div align="center">性别</div></td>
         <td width="100" bgcolor="#C2C41F"><div align="center">班级</div></td>
         <td width="297" bgcolor="#C2C41F"><div align="center">住址</div></td>
        </tr>
  
    <?php
    
     while($info=mysql_fetch_array($sql))
  {
  ?>
  <tr>
         <td height="20" bgcolor="#FFFFFF"><div align="center"><?php echo $info[sno];?></div></td>
         <td height="20" bgcolor="#FFFFFF"><div align="center"><?php echo $info[sname];?></div></td>
         <td height="20" bgcolor="#FFFFFF">
   <div align="center">
   <?php
   if($info[ssex]=='1')
   echo "男";
   else
   echo "女";?></div></td>
         <td height="20" bgcolor="#FFFFFF"><div align="center"><?php echo $info[sclass];?></div></td>
         <td height="20" bgcolor="#FFFFFF"><div align="center"><?php echo $info[saddress];?></div></td>
        </tr>
       <?php  
     }
  echo "</table>";
  }
    
  }

public function toPage()
{
?>
    <table width="704" height="20" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
         <td width="342">&nbsp;共有学生信息&nbsp;<?php echo $this->total;?>&nbsp;条&nbsp;每页显示&nbsp;<?php echo $this->pagesize;?>&nbsp;条&nbsp;第&nbsp;<?php echo $this->page;?>&nbsp;页/共&nbsp;<?php echo $this->pagecount;?>&nbsp;页</td>
         <td width="362"><div align="right">
        <a href="<?php echo $_SERVER["PHP_SELF"]?>?page=1">首页</a>
              <a href="<?php echo $_SERVER["PHP_SELF"]?>?page=<?php
       if($this->page>1)
        echo $this->page-1;
       else
     echo 1;
     ?>">上一页</a>
     <a href="<?php echo $_SERVER["PHP_SELF"]?>?page=<?php
       if($this->page<$this->pagecount-1)
         echo $this->page+1;
       else
      echo $this->pagecount;
     ?>">下一页</a>
              <a href="<?php echo $_SERVER["PHP_SELF"]?>?page=<?php echo $this->pagecount;?>">尾页</a>
  
   </div></td>
        </tr>
       </table>
  
}
        
  public function __destruct()
{
      mysql_close($this->conn);
}

  }
Tags:

内部报刊管理原则

[ 不指定 2008/11/01 18:35 | by wxxslt ]
      一、内部报刊是指持“内部报刊准印证”、不列入“国内统一刊号”的报刊,不是指持“报刊登记证”、列入“国内统一刊号”的报刊中限定内部发行部分。


    二、内部报刊是在本系统、本行业、本单位内用于指导工作、交流经验、交换信息的非商品性连续出版物。它不是独立机构,不具备法人资格。“内部报刊准印证”只发给此类出版物。


    三、申办内部报刊,应具备下列条件:

    1.有符合宪法规定的、为社会主义精神文明和物质文明建设服务的宗旨;


    2.有明确的主办单位、明确的专业范围和编辑方针;

    3.有切实担负领导责任的上级主管单位。属中央单位办的内部报刊,应由中央部委级部门主管;地方单位办的内部报刊,应由地方厅局级部门主管;中央单位在地方办的内部报刊,应由本单位设在当地的下属部门(司局级以上,含司局级)主管,中央部委级单位不得直接主管在地方办的内部报刊。


    4.有固定的编辑部。编辑部成员必须是主办单位编制内的正式工作人员。编辑部应与主办单位同在一地。


    5.有必需的资金、固定的办公场所、承印单位。

2009年腾讯校园招聘笔试题

[ 不指定 2008/11/01 14:31 | by wxxslt ]
不使用中间变量实现strlen函数,(strlen为c语言里面求字符串长度库函数)。给出了一个函数声明:
int strlen(const char *p);

#include<iostream.h>
int strlen_my(const char *p);
void main()
{  
    const char *p="wenxueba.net";
    int length=strlen_my(p);
cout<<length<<endl;
}  
int strlen_my(const char *p)
{
if(p==NULL)
    {
        return 0;
    }
    if(*p=='\0')
    {
        return 0;
    }
    else  
        return 1+strlen_my(++p);
}

沿途的感觉

[ 不指定 2008/10/31 09:13 | by wxxslt ]
          
    总喜欢这种沿途的感觉,在回家的车上,甚至于会打开一本英语小短文,细细地背着里面不懂的生词,这才不会浪费了途中的时间,总喜欢看着窗外的美景,想想昔日同学的嬉戏。
    看了文学社社员的几篇文章,大多都是感慨自己的大学生活,羡慕别人手牵手的游走在校园里。我真的无法从中体会到他们对未来的感觉。因为里面的文字,估计里面的文字就是介于80和90一代人的复杂感觉吧,微妙的感情又夹杂着一点空虚的意境。那天面试了几个竞选部长的社员,我对陈琳(08多媒体班长)的印象是最深的,觉得她说的话都是我想对所有社员说的。那天她唯一没回答我的问题是关于社团活动的问题,不过第二天她亲手给我张小策划,我觉得很欣慰。希望你学习方面也能成为你们班中的顶尖,不,这远远不够,因为你也是学计算机的,想有出息,就得拼命。
    回想自己学PHP也有一段时间了,现在是停滞不前了。大多的时间用来复习PHP,觉得以前理解的东西都不深刻,读书百遍,其义自现,是这个道理吗?

js改变网页字体的大小

[ 不指定 2008/10/28 17:09 | by wxxslt ]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml...
<html xmlns="http://www.w3.org/1999/xht...
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
//Font size control
function doZoom(size) {
  document.getElementById('zoomtext').style.fontSize=size+'px';
}
</script>
</head>

<body>
<div>设置字体大小:<a href="javascript:doZoom(16);">大</a> <a href="javascript:doZoom(14);">中</a> <a href="javascript:doZoom(12);">小</a></div>
<div id="zoomtext">这个是要显示的字体大小</div>
</body>
</html>




Else写的,很简单,估计难的我也看不懂…确实不错,实用,记录下。
Tags: ,
Pages: 2/14 First page Previous page 1 2 3 4 5 6 7 8 9 10 Next page Final page [ View by Articles | List ]