js源码大全:求Javascript的代码(js代码大全网站源码)

发布时间 : 09-19

方法一js源码大全:使用flash,效果比较好,网上都能搜到。js代码引入flash就行了

方法二:使用jquery,首先下载个jquery的js。然后

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " /TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns=" /1999/xhtml">

<head>

    <title>无标题页</title>

    <script type="text/javascript" src="jquery.js"></script>

    <script language="javascript">

//Demo1:

$(function(){

var len = $("#idNum > li").length;

var index = 0;

$("#idNum li").mouseover(function(){

index = $("#idNum li").index(this);

showImg(index);

});

//滑入 停止动画,滑出开始动画.

$('#idTransformView').hover(function(){

if(MyTime){

clearInterval(MyTime);

}

},function(){

MyTime = setInterval(function(){

showImg(index)

index ;

if(index==len){index=0;}

} , 2000);

});

//自动开始

var MyTime = setInterval(function(){

showImg(index)

index ;

if(index==len){index=0;}

} , 2000);

})

// Demo1 : 关键函数:通过控制top ,来显示不通的幻灯片

function showImg(i){

$("#idSlider").stop(true,false).animate({top : -168*i},800);

$("#idNum li")

.eq(i).addClass("on")

.siblings().removeClass("on");

}

//Demo2:

$(function(){

var len2 = $("#idNum2 > li").length;

var index2 = 0;

$("#idNum2 li").mouseover(function(){

index2 = $("#idNum2 li").index(this);

showImg2(index2);

});

//滑入 停止动画,滑出开始动画.

$('#idTransformView2').hover(function(){

if(MyTime2){

clearInterval(MyTime2);

}

},function(){

MyTime2 = setInterval(function(){

showImg2(index2)

index2 ;

if(index2==len2){index2=0;}

} , 2000);

});

//自动开始

var MyTime2 = setInterval(function(){

showImg2(index2)

index2 ;

if(index2==len2){index2=0;}

} , 2000);

})

// Demo2 : 关键函数:通过控制left ,来显示不通的幻灯片

function showImg2(i){

$("#idSlider2").stop(true,false).animate({left : -408*i},800);

$("#idNum2 li")

.eq(i).addClass("on")

.siblings().removeClass("on");

}

    </script>

    <style type="text/css">

.container, .container * { margin:0; padding:0; }

.container { width:408px; height:168px; overflow:hidden; position:relative; }

.slider { position:absolute; }

.slider li { list-style:none; display:inline; }

.slider img { width:408px; height:168px; display:block; }

.slider2 { width:2000px; }

.slider2 li { float:left; }

.num { position:absolute; right:5px; bottom:5px; }

.num li { float: left; color: #FF7300; text-align: center; line-height: 16px; width: 16px; height: 16px; font-family: Arial; font-size: 12px; cursor: pointer; overflow: hidden; margin: 3px 1px; border: 1px solid #FF7300; background-color: #fff; }

.num li.on { color: #fff; line-height: 21px; width: 21px; height: 21px; font-size: 16px; margin: 0 1px; border: 0; background-color: #FF7300; font-weight: bold; }

</style>

</head>

<body>

    <div class="container" id="idTransformView">

    <ul class="slider" id="idSlider">

    <li>

    <img src="images/bilde1.jpg" alt="" /></li>

    <li>

    <img src="images/bilde2.jpg" alt="" /></li>

    <li>

    <img src="images/bilde3.jpg" alt="" /></li>

    <li>

    <img src="images/bilde4.jpg" alt="" /></li>

    <li>

    <img src="images/bilde5.jpg" alt="" /></li>

    <li>

    <img src="images/bilde6.jpg" alt="" /></li>

    <li>

    <img src="images/bilde7.jpg" alt="" /></li>

    <li>

    <img src="images/bilde8.jpg" alt="" /></li>

    <li>

    <img src="images/bilde9.jpg" alt="" /></li>

    <li>

    <img src="images/bilde10.jpg" alt="" /></li>

    </ul>

    <ul class="num" id="idNum">

    <li>1</li>

    <li>2</li>

    <li>3</li>

    <li>4</li>

    <li>5</li>

    <li>6</li>

    <li>7</li>

    <li>8</li>

    <li>9</li>

    <li>10</li>

    </ul>

    </div>

    <br />

    <br />

    <br />

    <div class="container" id="idTransformView2">

    <ul class="slider slider2" id="idSlider2">

    <li>

    <img src="images/bilde1.jpg" alt="" /></li>

    <li>

    <img src="images/bilde2.jpg" alt="" /></li>

    <li>

    <img src="images/bilde3.jpg" alt="" /></li>

    <li>

    <img src="images/bilde4.jpg" alt="" /></li>

    <li>

    <img src="images/bilde5.jpg" alt="" /></li>

    <li>

    <img src="images/bilde6.jpg" alt="" /></li>

    <li>

    <img src="images/bilde7.jpg" alt="" /></li>

    <li>

    <img src="images/bilde8.jpg" alt="" /></li>

    <li>

    <img src="images/bilde9.jpg" alt="" /></li>

    <li>

    <img src="images/bilde10.jpg" alt="" /></li>

    </ul>

    <ul class="num" id="idNum2">

    <li>1</li>

    <li>2</li>

    <li>3</li>

    <li>4</li>

    <li>5</li>

    <li>6</li>

    <li>7</li>

    <li>8</li>

    <li>9</li>

    <li>10</li>

    </ul>

    </div>

</body>

</html>

还有个是用js弄的轮播

<html>

<head>

    <title>无标题页</title>

    <script language="javascript" type="text/javascript">

var bannerAD=new Array();

var bannerADlink=new Array();

var adNum=0;

bannerAD[0]="01.jpg";

bannerADlink[0]=" ";

bannerAD[1]="02.jpg";

bannerADlink[1]=" ";

bannerAD[2]="03.jpg";

bannerADlink[2]=" ";

bannerAD[3]="04.jpg";

bannerADlink[3]=" ";

bannerAD[3]="05.jpg";

bannerADlink[3]=" ";

var preloadedimages=new Array();

for (i=1;i<bannerAD.length;i ){

preloadedimages[i]=new Image();

preloadedimages[i].src=bannerAD[i];

}

function setTransition(){

if (document.all){

document.all.bannerADrotator.filters.revealTrans.Transition=Math.floor(Math.random()*23);

document.all.bannerADrotator.filters.revealTrans.apply();

}

}

function playTransition(){

if (document.all)

document.all.bannerADrotator.filters.revealTrans.play()

}

function nextAd(){

if(adNum<bannerAD.length-1)adNum ;

else adNum=0;

setTransition();

document.images.bannerADrotator.src=bannerAD[adNum];

playTransition();

theTimer=setTimeout("nextAd()", 5000);

}

function jump2url(){

jumpUrl=bannerADlink[adNum];

jumpTarget='_blank';

if (jumpUrl != ''){

if (jumpTarget != '')window.open(jumpUrl,jumpTarget);

else location.href=jumpUrl;

}

}

function displayStatusMsg() {

status=bannerADlink[adNum];

document.returnValue = true;

}

    </script>

</head>

<body>

    <a href="javascript:jump2url()">

    <img>

    border="0" name="bannerADrotator" id="bannerADrotator" height="205" width="450"></a>

    <script language="JavaScript">nextAd()</script>

</body>

</html>

文章推荐:

js源码大全:求Javascript的代码(js代码大全网站源码)

在线调用的js下载到本地不能用:怎样把网上的这个页面下载到本地离线运行?(js下载解析本地文件)

json数组格式化:php如何接收json数据?(json数组转化为list)

三益钢琴js115:三益钢琴ES系列和JS系列有什么区别?(三益钢琴js115ir价格)

spring json 字符串:说一下spring常用的注解,并举例说明怎么用?(spring接收json字符串)