找回密码
 注册
搜索
热搜: 回贴
  • 前程无忧官网首页 有什么好的平台可以
  • 最新的销售平台 互联网营销的平台有哪
  • 制作网页的基本流程 网页制作和网页设
  • 【帝国CMS】输出带序号的列表(数字排
  • 网站建设公司 三一,中联,极东泵车的
  • 织梦 建站 织梦网站模版后台怎么更改
  • 云服务官网 哪些网站有免费的简历模板
  • 如何建网站要什么条件 建网站要用什么
  • 吉林市移动公司电话 吉林省退休人员网
  • 设计类毕业论文 网站设计与实现毕业论
查看: 8137|回复: 1

js特效002

[复制链接]
发表于 2009-11-29 01:48:39 | 显示全部楼层 |阅读模式 IP:江苏扬州
漂亮的脚本日历:
<Script LANGUAGE="JavaScript">
var months = new Array("一", "二", "三","四", "五", "六", "七", "八", "九","十", "十一", "十二");
var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31,30, 31, 30, 31);
var days = new Array("日","一", "二", "三","四", "五", "六");
var classTemp;
var today=new getToday();
var year=today.year;
var month=today.month;
var newCal;
function getDays(month, year) {
   if (1 == month) return ((0 == year % 4) && (0 != (year % 100))) ||(0 == year % 400) ? 29 : 28;
   else return daysInMonth[month];
}
function getToday() {
   this.now = new Date();
   this.year = this.now.getFullYear();
   this.month = this.now.getMonth();
   this.day = this.now.getDate();
}
function Calendar() {
   newCal = new Date(year,month,1);
   today = new getToday();   
   var day = -1;
   var startDay = newCal.getDay();
   var endDay=getDays(newCal.getMonth(), newCal.getFullYear());
   var daily = 0;
   if ((today.year == newCal.getFullYear()) &&(today.month == newCal.getMonth()))
   {
    day = today.day;
   }
   var caltable = document.all.caltable.tBodies.calendar;
   var intDaysInMonth =getDays(newCal.getMonth(), newCal.getFullYear());
   for (var intWeek = 0; intWeek < caltable.rows.length;intWeek++)
    for (var intDay = 0;intDay < caltable.rows[intWeek].cells.length;intDay++)
    {
     var cell = caltable.rows[intWeek].cells[intDay];
     var montemp=(newCal.getMonth()+1)<10?("0"+(newCal.getMonth()+1)):(newCal.getMonth()+1);         
     if ((intDay == startDay) && (0 == daily)){ daily = 1;}
     var daytemp=daily<10?("0"+daily):(daily);
     var d="<"+newCal.getFullYear()+"-"+montemp+"-"+daytemp+">";
     if(day==daily) cell.className="DayNow";
     else if(intDay==6) cell.className = "DaySat";
     else if (intDay==0) cell.className ="DaySun";
     else cell.className="Day";
     if ((daily > 0) && (daily <= intDaysInMonth))
     {
      cell.innerText = daily;
      daily++;
     } else
     {
      cell.className="CalendarTD";
      cell.innerText = "";
     }
   }
   document.all.year.value=year;
   document.all.month.value=month+1;
}
function subMonth()
{
   if ((month-1)<0)
   {
    month=11;
    year=year-1;
   } else
   {
    month=month-1;
   }
   Calendar();
}
function addMonth()
{
   if((month+1)>11)
   {
    month=0;
    year=year+1;
   } else
   {
    month=month+1;
   }
   Calendar();
}
function setDate()
{
   if (document.all.month.value<1||document.all.month.value>12)
   {
    alert("月的有效范围在1-12之间!");
    return;
   }
   year=Math.ceil(document.all.year.value);
   month=Math.ceil(document.all.month.value-1);
   Calendar();
}
</Script>
<Script>
function buttonOver()
{
var obj = window.event.srcElement;
obj.runtimeStyle.cssText = "background-color:#FFFFFF";
// obj.className="Hover";
}
function buttonOut()
{
var obj = window.event.srcElement;
window.setTimeout(function(){obj.runtimeStyle.cssText = "";},300);
}
</Script>
<Style>
Input {font-family: verdana;font-size: 9pt;text-decoration: none;background-color: #FFFFFF;height: 20px;border: 1px solid #666666;color:#000000;}
.Calendar {font-family: verdana;text-decoration: none;width: 170;background-color: #C0D0E8;font-size: 9pt;border:0px dotted #1C6FA5;}
.CalendarTD {font-family: verdana;font-size: 7pt;color: #000000;background-color:#f6f6f6;height: 20px;width:11%;text-align: center;}
.Title {font-family: verdana;font-size: 11pt;font-weight: normal;height: 24px;text-align: center;color: #333333;text-decoration: none;background-color: #A4B9D7;border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-bottom-style:1px;border-top-color: #999999;border-right-color: #999999;border-bottom-color: #999999;border-left-color: #999999;}
.Day {font-family: verdana;font-size: 7pt;color:#243F65;background-color: #E5E9F2;height: 20px;width:11%;text-align: center;}
.DaySat {font-family: verdana;font-size: 7pt;color:#FF0000;text-decoration: none;background-color:#E5E9F2;text-align: center;height: 18px;width: 12%;}
.DaySun {font-family: verdana;font-size: 7pt;color: #FF0000;text-decoration: none;background-color:#E5E9F2;text-align: center;height: 18px;width: 12%;}
.DayNow {font-family: verdana;font-size: 7pt;font-weight: bold;color: #000000;background-color: #FFFFFF;height: 20px;text-align: center;}
.DayTitle {font-family: verdana;font-size: 9pt;color: #000000;background-color: #C0D0E8;height: 20px;width:11%;text-align: center;}
.DaySatTitle {font-family: verdana;font-size: 9pt;color:#FF0000;text-decoration: none;background-color:#C0D0E8;text-align: center;height: 20px;width: 12%;}
.DaySunTitle {font-family: verdana;font-size: 9pt;color: #FF0000;text-decoration: none;background-color: #C0D0E8;text-align: center;height: 20px;width: 12%;}
.DayButton {font-family: Webdings;font-size: 9pt;font-weight: bold;color: #243F65;cursor:hand;text-decoration: none;}
</Style>

<table border="0" cellpadding="0" cellspacing="1" class="Calendar" id="caltable">
<thead>
      <tr align="center" valign="middle">
   <td colspan="7" class="Title">
    <a href="javaScript:subMonth();" title="上一月" Class="DayButton">3</a> <input name="year" type="text" size="4" maxlength="4" onkeydown="if (event.keyCode==13){setDate()}" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')"   onpaste="this.value=this.value.replace(/[^0-9]/g,'')"> 年 <input name="month" type="text" size="1" maxlength="2" onkeydown="if (event.keyCode==13){setDate()}" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')"   onpaste="this.value=this.value.replace(/[^0-9]/g,'')"> 月 <a href="JavaScript:addMonth();" title="下一月" Class="DayButton">4</a>
   </td>
</tr>
<tr align="center" valign="middle">
   <Script LANGUAGE="JavaScript">  
    document.write("<TD class=DaySunTitle id=diary >" + days[0] + "</TD>");
    for (var intLoop = 1; intLoop < days.length-1;intLoop++)
     document.write("<TD class=DayTitle id=diary>" + days[intLoop] + "</TD>");
     document.write("<TD class=DaySatTitle id=diary>" + days[intLoop] + "</TD>");
   </Script>
</TR>
</thead>
<TBODY border=1 cellspacing="0" cellpadding="0" ID="calendar" ALIGN=CENTER ONCLICK="getDiary()">
<Script LANGUAGE="JavaScript">
   for (var intWeeks = 0; intWeeks < 6; intWeeks++)
   {
    document.write("<TR style='cursor:hand'>");
    for (var intDays = 0; intDays < days.length;intDays++) document.write("<TD class=CalendarTD onMouseover='buttonOver();' onMouseOut='buttonOut();'></TD>");
    document.write("</TR>");
   }
</Script>
</TBODY>
</TABLE>
<Script   LANGUAGE="JavaScript">
Calendar();
</Script>

弹出提示的效果:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>cao888---提示</title>
</head>
<body>
<script language=javascript>
var cao_x,cao_y;
function cao888()
{
this.display=display;
}
function display()
{
   document.write("<table align=center><tr><td><button style='width:100px;height:30px;font-size:12px;border:1px solid #A4B3C8;background-color:green;' type=button onclick=document.getElementById('cao1').style.display='block' onfocus=this.blur()>CAO留言</button></td></tr></table>");
   document.write("<div   id='cao1' style='font-size:12px;position:absolute;display:none;text-align:center;overflow:visible'>");
   document.write("<div style='position:absolute;top:expression((body.clientHeight-300)/2);left:expression((body.clientWidth-200)/2);width:200px;height:180px;background-color:#dbdbdb;border:1px solid #cccccc;'>");
   document.write("<table width=200 height=20 bgcolor=green onmousedown='cao_x=event.x-parentNode.style.pixelLeft;cao_y=event.y-parentNode.style.pixelTop;setCapture();' onmouseup='releaseCapture();' onmousemove='caoMove(this.parentNode)' style='cursor:move;'>");
   document.write("<tr align=center>");
   document.write("<td align=left>提示:CAO888</td>");
   document.write("</tr>");
   document.write("</table>");
   document.write("<span style= cursor:hand onclick=this.parentNode.parentNode.style.display='none';><img src='http://pic1.blueidea.com/bbs/topic5.gif'><br>CAO呀,错误了...<br>[确定]</span>");
   document.write("   </div>");
   document.write("</div>");
}
function caoMove(obj)   //实现层的拖移
{
   if(event.button==1)
   {
     var caoX=obj.clientLeft;
     var caoY=obj.clientTop;
     obj.style.pixelLeft=caoX+(event.x-cao_x);
     obj.style.pixelTop=caoY+(event.y-cao_y);
   }
}
</script>
<script language=javascript>
var mycao=new cao888();
mycao.display();
</script>
</body>
</html>

图片之间的切换:
<script language=JavaScript>
<!--
var imgUrl=new Array();
var imgLink=new Array();
var adNum=0;
var jumpUrl="http://sports.tom.com/";
imgLink[1]="http://sports.tom.com/gnzt/2005yg/";
imgLink[2]="http://sports.tom.com/zhty/";

imgUrl[1]="http://img.sports.tom.com/img/assets/200509/050927071818sportsgnzt200592701.jpg";
imgUrl[2]="http://img.sports.tom.com/img/assets/200509/050927075953zt20050926107.jpg";
var imgPre=new Array();
var j=0;
for (i=1;i<=imgUrl.length-1;i++) {
if(imgLink[i]!="") {j++;}
else {break;}
}
function playTran(){
if (document.all)
   imgInit.filters.revealTrans.play();
}
var key=0;
function nextAd(){
if(adNum<j)adNum++ ;
else adNum=1;
if( key==0 ){key=1;}
else if (document.all){
   imgInit.filters.revealTrans.Transition=6;
   imgInit.filters.revealTrans.apply();
   playTran();
}
document.images.imgInit.src=imgUrl[adNum];
jumpUrl=imgLink[adNum];
theTimer=setTimeout("nextAd()", 7000);
}
function goUrl(){
jumpTarget='_blank';
if (jumpUrl != ''){
   if (jumpTarget != '') window.open(jumpUrl,jumpTarget);
   else location.href=jumpUrl;
}
}
//-->
</script>
<a href="javascript:goUrl()"><img style="FILTER:
revealTrans(duration=2,transition=6);border:1 solid black" src="javascript:nextAd()" width=300
border=0 name=imgInit height="210"></a>
</body>
</html>


DIV_圆边圆角的实现:
<html xmlns:v>
<head>
<style>
v\:*{behavior: url(#default#VML);}
</style>
</head>
<body>
<v:roundRect style="position:absolute;left:20px;top:50px;width:200px;height:140px;" FillColor="#AAEAFA" Filled="T" />
</body>


跳动的菜单:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>模仿as效果的导航菜单</title>
<style type="text/css">
<!--
a:link,a:visited     { text-decoration: none; color: #666666 }
a:hover             { text-decoration: underline }
#hor1 {
     position:absolute;
     left:320px;
     top:20px;
     width:220px;
     height:20px;
     z-index:1;
     background-color: #999900;
}
#hor2 {
     position:absolute;
     left:320px;
     top:40px;
     width:220px;
     height:20px;
     z-index:2;
     background-color: #FFCC00;
}
#hor3 {
     position:absolute;
     left:320px;
     top:60px;
     width:220px;
     height:20px;
     z-index:3;
     background-color: #99CC00;
}
#board1 {
     position:absolute;
     left:320px;
     top:40px;
     width:220px;
     height:120px;
     z-index:-100;
     background-color: #333333;
     visibility: hidden;
}
body,td,th {
     font-family: Verdana, Arial, Helvetica, sans-serif;
     font-size: 12px;
     color: #FFFFFF;
     font-weight: bold;
}
body {
     background-color: #666666;
}
#board2 {
     position:absolute;
     left:320px;
     top:60px;
     width:220px;
     height:120px;
     z-index:-90;
     background-color: #333333;
     visibility: hidden;
}
#board3 {
     position:absolute;
     width:220px;
     height:120px;
     z-index:-80;
     left: 320px;
     top: 80px;
     background-color: #333333;
     visibility: hidden;
}
#hor4 {
     position:absolute;
     left:320px;
     top:80px;
     width:220px;
     height:20px;
     z-index:4;
     background-color: #99CCCC;
}
#board4 {
     position:absolute;
     left:320px;
     top:100px;
     width:220px;
     height:120px;
     z-index:-70;
     background-color: #333333;
     visibility: hidden;
}
-->
</style>
<script type="text/javascript">
lastNo=0
function re(menu_no){
if(lastNo!=menu_no){
cur=menu_no+1
lastNo=menu_no
rest()
}else{
cur=100
}
document.getElementById("board"+menu_no).style.visibility="visible"
}
function rest(){
for(i=1;i<=4;i++){
document.getElementById("hor"+i).style.top=20*i;
document.getElementById("board"+i).style.visibility="hidden"
}
menu_num=4;
act=1
height=120+20
speed=0;
posY=0;
}
function huke(){
if(act==1&&cur<100){
speed=(height-posY)*0.69+speed*0.6
posY+=speed
for(i=cur;i<=menu_num;i++){
document.getElementById("hor"+i).style.top=posY+(i-2)*20
}
if(Math.abs(height-posY)<0.5){
for(i=cur;i<=menu_num;i++){
document.getElementById("hor"+i).style.top=height+(i-2)*20
}
act=0
}
setTimeout("huke()",50)
}
}
</script>
</head>
<body>
<div id="hor1" onclick="re(1);huke()">News</div>
<div id="hor2" onclick="re(2);huke()">Populor</div>
<div id="hor3" onclick="re(3);huke()">Sports</div>
<div id="hor4" onclick="re(4);huke()">Woman</div>
<div id="board1">1.由AS而想起Javascript<br />2.用Jscript写ASP有没有先天性的不足?<br />3.没有了。</div>
<div id="board2">1.xhtml+css真的来了吗?<br />2.Flash取代传统网站<br />3.Flash何时才能连接数据库?</div>
<div id="board3">1.程序员与小姐的10个相同。<br />2.中国的程序员与中国的足球?</div>
<div id="board4">1.二十一世纪最缺的是什么?人才<br />
<a href="http://www.gamvan.com" target="_blank">http://www.gamvan.com</a>
<a href="http://www.gamvan.com" target="_blank">http://www.gamvan.com</a></div>
</body>
</html>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-10-1 17:23 , Processed in 0.191969 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表