(1)Login.html
function validateForm(){
// 检查 用户名 是否 为空
var usernameVl= document.getElementById("username").value;
if(usernameVl==""){
document.getElementById("username_msg").innerHTML = "NULL".fontcolor("red");
return false;
}else{
document.getElementById("username_msg").innerHTML = "OK".fontcolor("green");
}
// 检查 密码 是否 为空
var passwordVl = document.getElementById("password").value;
if(passwordVl==""){
document.getElementById("password_msg").innerHTML = "NULL".fontcolor("red");
return false;
}else{
document.getElementById("password_msg").innerHTML = "OK".fontcolor("green");
return true;
}
}
(2)zhuce.html
function validate(){//判断两次密码
mdiv = document.getElementById("psw");
var s1 = document.getElementById("password").value;
var s2 = document.getElementById("password2").value;
if(s1!=s2){
mdiv.innerHTML="<font color='red'size='1'>错误!</font>";
}
}
(3)index.html
<script type="text/javascript">
var curIndex = 0;
var timeInterval = 1000;
var arr = new Array();
arr[0] = "t1.jpg";
arr[1] = "t2.jpg";
arr[2] = "t3.jpg";
arr[3] = "t4.jpg";
setInterval(changeImg,timeInterval);
function changeImg() {
var obj = document.getElementById("obj");
if (curIndex == arr.length-1) {
curIndex = 0;
} else {
curIndex += 1;
}
obj.src = arr[curIndex];
}
</script>
<script language="javascript">
setInterval(test,1000);
var array = new Array();
var index = 0;
var array = new Array("t1.jpg","t2.jpg","t3.jpg","t4.jpg","t1.jpg");
function test() {
var myimg=document.getElementById("imgs");
if(index==array.length-1)
{ index=0; }else{ index++; }
myimg.src=array[index];
}
window.onload= function Time_Set()//显示系统时间
{
TM=window.setTimeout("Time_Set()",1000);
var today=new Date();
var hh= today.getHours();
var mm= today.getMinutes();
var ss= today.getSeconds();
document.getElementById("disp").innerHTML="当前时间是:"+hh+":"+mm+":"+ss;
}
</script>
//浮窗
<script>
var xPos = 0;
var yPos = 0;
var step = 1;
var delay = 30;
var height = 0;
var Hoffset = 0;
var Woffset = 0;
var yon = 0;
var xon = 0;
var pause = true;
var interval;
img1.style.top = yPos;
function changePos() {
width = document.documentElement.clientWidth;
height = document.documentElement.clientHeight;
Hoffset = img1.offsetHeight;
Woffset = img1.offsetWidth;
img1.style.left = xPos + document.documentElement.scrollLeft + "px";
img1.style.top = yPos + document.documentElement.scrollTop + "px";
if (yon)
{ yPos = yPos + step; }
else
{ yPos = yPos - step; }
if (yPos <500)
{ yon = 1; yPos = 0; }
if (yPos >= (height - Hoffset))
{ yon = 0; yPos = (height - Hoffset); }
if (xon)
{ xPos = xPos + step; }
else
{ xPos = xPos - step; }
if (xPos < 0)
{ xon = 1; xPos = 0; }
if (xPos >= (width - Woffset))
{ xon = 0; xPos = (width - Woffset); }
}
function start() {
img1.visibility = "visible";
interval = setInterval('changePos()', delay);
}
function pause_resume() {
if (pause) {
clearInterval(interval);
pause = false;
}
else {
interval = setInterval('changePos()', delay);
pause = true;
}
}
start();
</script>
(4)search.html
<script>//div切换
function setTab(name,cursel,n){
for(i=1;i<=n;i++){
var menu=document.getElementById(name+i);
var con=document.getElementById("con_"+name+"_"+i);
menu.className=i==cursel?"hover":"";
con.style.display=i==cursel?"block":"none";
}
}
</script>