Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
108 changes: 108 additions & 0 deletions 2012-Autumn-Homework/KaixinDivCssLayout/zhangguodong/kaixin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
window.addEvent =function(element,event,fn){
if(element.addEventListener)
{
element.addEventListener(event,fn,false);

}
else if(element.attachEvent){
element.attachEvent("on"+event, function(){ fn.call(element) });

}
}
function tip(title,isInfo,id)
{
this.title=title;
this.isInfo=isInfo;
this.tipDom=document.getElementById(id);
}
tip.prototype=(function()
{
//���ɺ��ʵ�Tip���ڲ�����
function genTip(tipDomObject,title,isInfo)
{
if(tipDomObject=="email")
tipDomObject.className="tipFormat";
else if(tipDomObject=="password")
tipDomObject.className="a";
else if(tipDomObject=="name")
tipDomObject="b";
if(isInfo===false)
tipDomObject.innerHTML="<img src='error.gif' /><span>" + title + "</span>";
else
tipDomObject.innerHTML="<span>"+title+"</span>";
}
//������ �����ڴ˴�Ӧ��this
//alert(this.title+" in closure");
return {
showTip:function()
{
genTip(this.tipDom,this.title,this.isInfo);
//alert(this.tipDom.innerHTML);
this.tipDom.style.display="block";
},
hideTip:function()
{
this.tipDom.style.display="none";
}
}
})();



function prepareTip()
{
var e=document.getElementById("email");
window.addEvent(e,'blur',blurFn);
window.addEvent(e,'focus',focusFn);
var n=document.getElementById("name");
window.addEvent(n,'blur',blurFn);
window.addEvent(n,'focus',focusFn);
var p=document.getElementById("password");
window.addEvent(p,'blur',blurFn);
window.addEvent(p,'focus',focusFn);
}
function blurFn()
{
var title;
switch(this.id)
{
case "email":
title="�����ʽ����";
break;
case "password":
title="���벻��";
break;
case "name":
title="����������Ҫ��";
break;
}
var t=new tip(title,false,this.id+"tip");
//�ȹر�ԭ����info tip
t.hideTip();
//����д����ʱ���� error tip
if(checkFormat(this))
t.showTip();
}
function checkFormat(o)
{
// o ��Ҫ����ʽ��dom����
return true;
}
function focusFn()
{
var title;
switch(this.id)
{
case "email":
title="����������";
break;
case "password":
title="����������";
break;
case "name":
title="����������";
break;
}
var t=new tip(title,true,this.id+"tip");
t.showTip();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<link rel="stylesheet" href="css/main.css" type="text/css"></link>
<link rel="stylesheet" href="css/main.css" type="text/css">
<link href="validate.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="kaixin.js"></script>
</head>
<body>
<body onload="prepareTip();">
<form method="post">
<div class="header">
<div class="header_pic">
Expand All @@ -32,21 +34,21 @@ <h2>
<label class="ultit">
�������䣺</label>
<div class="input">
<input class="txt" type="text" name="txtemail" /></div>
<input id="email" class="txt" type="text" name="txtemail" /><div id="emailtip"></div></div>
<div class="note">
���û�����䣬�������<a href="#">�˺�ע��</a></div>
</li>
<li>
<label class="ultit">
�������룺</label>
<div class="input">
<input class="txt" type="password" name="txtpassword"></div>
<input id="password" class="txt" type="password" name="txtpassword"><div id="passwordtip"></div></div>
</li>
<li>
<label class="ultit">
��&nbsp&nbsp&nbsp&nbsp����</label>
<div class="input">
<input class="txt" type="text" name="txtname"></div>
<input id="name" class="txt" type="text" name="txtname"><div id="nametip"></div></div>
</li>
<li>
<label class="ultit">
Expand Down
24 changes: 24 additions & 0 deletions 2012-Autumn-Homework/KaixinDivCssLayout/zhangguodong/validate.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.tipFormat {
padding: 2px 6px;
color: #333;
background-color: #FFFFCD;
border: 1px solid #DBDBDB;
top: 0;
width: 178px;
}
.a {
padding: 2px 6px;
color: #333;
background-color: #FFFFCD;
border: 1px solid #DBDBDB;
top: 0;
width: 178px;
}
.b {
padding: 2px 6px;
color: #333;
background-color: #FFFFCD;
border: 1px solid #DBDBDB;
top: 0;
width: 178px;
}
Binary file added 2012-Autumn-Homework/xuezhichao/error.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2012-Autumn-Homework/xuezhichao/image/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2012-Autumn-Homework/xuezhichao/image/110.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2012-Autumn-Homework/xuezhichao/image/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2012-Autumn-Homework/xuezhichao/image/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2012-Autumn-Homework/xuezhichao/image/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2012-Autumn-Homework/xuezhichao/image/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2012-Autumn-Homework/xuezhichao/image/error.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
113 changes: 113 additions & 0 deletions 2012-Autumn-Homework/xuezhichao/kaixin.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@

*{padding: 0; margin: 0 auto; }
body
{
font-size: 0.8em;
font-family: ����;
font-weight: normal;

}

#header
{
margin: auto;
background-color:#dd3943;
height: 40px;
width:100%;

}

h1
{
font-size: 1.6em;
font-family: ��Բ;
font-weight: bolder;
}

h2
{
font-size: 1.1em;
font-family: ����;
font-weight: bold;
}

h3
{
font-size: 1.6em;
font-family: ��Բ;
font-weight: bold;
color: #DC143C;
}

.pic1
{
float: left;
padding-left: 10%;
}

.pic2
{
float: right;
padding-right: 10%;
padding-top: 10px
}
#main
{
padding-top: 15px;
width:980px;
margin: auto;
}
#contentleft
{
width: 320px;
float: left;
height: 370px;
margin-top: 65px;
margin-left:60px;
}

#contentright
{
border:0;
width: 320px;
float: right;
height: 350px;
margin-top: 60px;
background-color: #fdfdfd;
}
#contentright1
{
border: 1px solid #eeeeee;
width: 317px;
float: right;
height: 160px;
padding-top: 25px;
background-color: #fdfdfd;
}
#contentright2
{
border: 1px solid #eeeeee;
width: 317px;
float: right;
height: 170px;
background-color: #fdfdfd;
}
#secondcontent
{
width: 950px;
height: 30px;
margin: auto;
padding-left: 90px;
padding-right: 90px;
padding-top: 120px;
clear: both;
}
#footer
{
width:950px;
padding-top: 8px;
padding-bottom: 3px;
background-color: #E8E8E8;
text-align: center;
clear: both;
}
Loading