當前位置:首頁 » 操作系統 » 圖片切換源碼

圖片切換源碼

發布時間: 2022-12-29 14:19:05

『壹』 HTML中如何做圖片切換效果,跪求代碼

1、首先輸入代碼:

<div class="wrapper">

<div id="focus">

<ul>

<li><a href="http://www.lanrentuku.com/" target="_blank"><img src="img/01.jpg" alt="QQ商城焦點圖效果下載" /></a></li>

『貳』 求HTML圖片切換效果代碼!

HTML是不能實現你想的那種效果的,要用js代碼的,下面是我以前修改過的一個例子:<html>
<head>
<script type="text/javascript">
var theA=new Array(3);
for(i=0,n=theA.length;i<n;i++)
{theA[i]=new Image();<br> theA[i].src=i+'.jpg';}
var currentImage=1;
var run=true;
var speed=1000;
function changeSize1()
{
if(!document.images)
return;
if(!run)
return;
document.getElementById("myImage").src=theA[currentImage].src;
currentImage++;
if(currentImage>theA.length-1)
currentImage=0;
setTimeout('changeSize1()',speed);
}
</script>
</head>
<body onload="changeSize1()">
<img id="myImage" src="0.jpg" border="0" >
</body>
</html>裡面是三張圖面交換的,你可以修改,不清楚的就追問

『叄』 JavaScript 的網頁圖片切換代碼

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>網頁特效 首頁圖片切換</title>
<style type="text/css">
/* Reset style */
* { margin:0; padding:0; word-break:break-all; }
body {
background:#fff;
color:#000000;
font:12px/1.6em Helvetica, Arial, sans-serif;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
h1, h2, h3, h4, h5, h6 { font-size:1em; }
a { color:#0287CA; text-decoration:none; }
a:hover { text-decoration:underline; }
ul, li { list-style:none; }
fieldset, img { border:none; }
legend { display:none; }
em, strong, cite, th { font-style:normal; font-weight:normal; }
input, textarea, select, button { font:12px Helvetica, Arial, sans-serif; }
table { border-collapse:collapse; }
html { overflow:-moz-scrollbars-vertical; } /*Always show Firefox scrollbar*/
/* iFocus style */
#ifocus { width:650px; height:245px; margin:0px; border:1px solid #DEDEDE; background:#F8F8F8; }
#ifocus_pic { display:inline; position:relative; float:left; width:540px; height:225px; overflow:hidden; margin:10px 0 0 10px; }
#ifocus_piclist { position:absolute; }
#ifocus_piclist li { width:550px; height:225px; overflow:hidden; }
#ifocus_piclist img { width:550px; height:225px; }
#ifocus_btn { display:inline; float:right; width:91px; margin:9px 9px 0 0; }
#ifocus_btn li { width:91px; height:57px; cursor:pointer; opacity:0.5; -moz-opacity:0.5; filter:alpha(opacity=50); }
#ifocus_btn img { width:75px; height:45px; margin:7px 0 0 11px; }
#ifocus_btn .current { background: url(img/ifocus_btn_bg.gif) no-repeat; opacity:1; -moz-opacity:1; filter:alpha(opacity=100); }
#ifocus_opdiv { position:absolute; left:0; bottom:0; width:545px; height:35px; background:#000; opacity:0.5; -moz-opacity:0.5; filter:alpha(opacity=50); }
#ifocus_tx { position:absolute; left:8px; bottom:8px; color:#FFF; }
#ifocus_tx .normal { display:none; }
</style>
<script type="text/javascript">
function $(id) { return document.getElementById(id); }
function addLoadEvent(func){
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function(){
oldonload();
func();
}
}
}
function moveElement(elementID,final_x,final_y,interval) {
if (!document.getElementById) return false;
if (!document.getElementById(elementID)) return false;
var elem = document.getElementById(elementID);
if (elem.movement) {
clearTimeout(elem.movement);
}
if (!elem.style.left) {
elem.style.left = "0px";
}
if (!elem.style.top) {
elem.style.top = "0px";
}
var xpos = parseInt(elem.style.left);
var ypos = parseInt(elem.style.top);
if (xpos == final_x && ypos == final_y) {
return true;
}
if (xpos < final_x) {
var dist = Math.ceil((final_x - xpos)/10);
xpos = xpos + dist;
}
if (xpos > final_x) {
var dist = Math.ceil((xpos - final_x)/10);
xpos = xpos - dist;
}
if (ypos < final_y) {
var dist = Math.ceil((final_y - ypos)/10);
ypos = ypos + dist;
}
if (ypos > final_y) {
var dist = Math.ceil((ypos - final_y)/10);
ypos = ypos - dist;
}
elem.style.left = xpos + "px";
elem.style.top = ypos + "px";
var repeat = "moveElement('"+elementID+"',"+final_x+","+final_y+","+interval+")";
elem.movement = setTimeout(repeat,interval);
}
function classNormal(iFocusBtnID,iFocusTxID){
var iFocusBtns= $(iFocusBtnID).getElementsByTagName('li');
var iFocusTxs = $(iFocusTxID).getElementsByTagName('li');
for(var i=0; i<iFocusBtns.length; i++) {
iFocusBtns[i].className='normal';
iFocusTxs[i].className='normal';
}
}
function classCurrent(iFocusBtnID,iFocusTxID,n){
var iFocusBtns= $(iFocusBtnID).getElementsByTagName('li');
var iFocusTxs = $(iFocusTxID).getElementsByTagName('li');
iFocusBtns[n].className='current';
iFocusTxs[n].className='current';
}
function iFocusChange() {
if(!$('ifocus')) return false;
$('ifocus').onmouseover = function(){atuokey = true};
$('ifocus').onmouseout = function(){atuokey = false};
var iFocusBtns = $('ifocus_btn').getElementsByTagName('li');
var listLength = iFocusBtns.length;
iFocusBtns[0].onmouseover = function() {
moveElement('ifocus_piclist',0,0,5);
classNormal('ifocus_btn','ifocus_tx');
classCurrent('ifocus_btn','ifocus_tx',0);
}
if (listLength>=2) {
iFocusBtns[1].onmouseover = function() {
moveElement('ifocus_piclist',0,-225,5);
classNormal('ifocus_btn','ifocus_tx');
classCurrent('ifocus_btn','ifocus_tx',1);
}
}
if (listLength>=3) {
iFocusBtns[2].onmouseover = function() {
moveElement('ifocus_piclist',0,-450,5);
classNormal('ifocus_btn','ifocus_tx');
classCurrent('ifocus_btn','ifocus_tx',2);
}
}
if (listLength>=4) {
iFocusBtns[3].onmouseover = function() {
moveElement('ifocus_piclist',0,-675,5);
classNormal('ifocus_btn','ifocus_tx');
classCurrent('ifocus_btn','ifocus_tx',3);
}
}
}
setInterval('autoiFocus()',3500);
var atuokey = false;
function autoiFocus() {
if(!$('ifocus')) return false;
if(atuokey) return false;
var focusBtnList = $('ifocus_btn').getElementsByTagName('li');
var listLength = focusBtnList.length;
for(var i=0; i<listLength; i++) {
if (focusBtnList[i].className == 'current') var currentNum = i;
}
if (currentNum==0&&listLength!=1 ){
moveElement('ifocus_piclist',0,-225,5);
classNormal('ifocus_btn','ifocus_tx');
classCurrent('ifocus_btn','ifocus_tx',1);
}
if (currentNum==1&&listLength!=2 ){
moveElement('ifocus_piclist',0,-450,5);
classNormal('ifocus_btn','ifocus_tx');
classCurrent('ifocus_btn','ifocus_tx',2);
}
if (currentNum==2&&listLength!=3 ){
moveElement('ifocus_piclist',0,-675,5);
classNormal('ifocus_btn','ifocus_tx');
classCurrent('ifocus_btn','ifocus_tx',3);
}
if (currentNum==3 ){
moveElement('ifocus_piclist',0,0,5);
classNormal('ifocus_btn','ifocus_tx');
classCurrent('ifocus_btn','ifocus_tx',0);
}
if (currentNum==1&&listLength==2 ){
moveElement('ifocus_piclist',0,0,5);
classNormal('ifocus_btn','ifocus_tx');
classCurrent('ifocus_btn','ifocus_tx',0);
}
if (currentNum==2&&listLength==3 ){
moveElement('ifocus_piclist',0,0,5);
classNormal('ifocus_btn','ifocus_tx');
classCurrent('ifocus_btn','ifocus_tx',0);
}
}
addLoadEvent(iFocusChange);
</script>
</head>
<body>
<br />
<div align="center">
<div id="ifocus">
<div id="ifocus_pic">
<div id="ifocus_piclist" style="left:0; top:0;">
<ul>
<li><a href="#" target="_blank"><img src="/e/img/js/200909/1.jpg" alt="武林三國" border="0" /></a></li>
<li><a href="#" target="_blank"><img src="/e/img/js/200909/2.jpg" alt="武林英雄" border="0" /></a></li>
<li><a href="#" target="_blank"><img src="/e/img/js/200909/3.jpg" alt="商業大亨" border="0" /></a></li>
<li><a href="#" target="_blank"><img src="/e/img/js/200909/4.jpg" alt="帝國遠征" border="0" /></a></li>
</ul>
</div>
<div id="ifocus_opdiv"></div>
<div id="ifocus_tx">
<ul>
<li class="current">2008年度排名第一的網頁游戲</li>
<li class="normal">2009年最新的網頁游戲 </li>
<li class="normal">商業大亨,挑戰億萬富翁</li>
<li class="normal">一款2009年不得不玩的帝國遠征</li>
</ul>
</div>
</div>
<div id="ifocus_btn">
<ul>
<li class="current"><img src="/e/img/js/200909/s1.jpg" alt="" /></li>
<li class="normal"><img src="/e/img/js/200909/s2.jpg" alt="" /></li>
<li class="normal"><img src="/e/img/js/200909/s3.jpg" alt="" /></li>
<li class="normal"><img src="/e/img/js/200909/s4.jpg" alt="" /></li>
</ul>
</div>
</div>
</div>
</body>
</html>

自己改圖片鏈接和大小~~

『肆』 如何做易語言圖片自動切換源碼就是窗口啟動後、就會自動切換圖片、漸隱的那種

搞了好一什麼,效果出來了,用到不少綜合知識,數組,循環,判斷,和圖片,刷新顯示,以後窗口透明度這些綜合運用起來,

特別是判斷循環首這個,非常有用,直接取出一個目錄下所有圖片集

感覺樓主的分有點少,這個程序花不了精力,腦力,有分還請加點

『伍』 求圖片切換的源代碼

試試這個圖片切換

有12345數字一起切換

滑鼠點一下數字會變換到另一張圖片,不點就會自動換

裡面有教程和源碼

『陸』 怎麼把圖片轉換成HTML源碼

先把你的圖片傳到某個網路相冊里,然後在你淘寶店需要加圖片的地方輸入代碼
<img
src="你圖片的網路地址"
width="這是相片的寬(數字)"
height="這是相片的高(數字)"
alt="這是瀏覽器上還沒出現圖片時在圖片位置所顯示的文字">

『柒』 HTML圖片自動切換的代碼

<script language =javascript > var curIndex=0; //時間間隔(單位毫秒),每秒鍾顯示一張,數組共有5張圖片放在Photos文件夾下。 var timeInterval=1000; var arr=new Array(); arr[0]="photos/1.jpg"; arr[1]="photos/2.jpg"; arr[2]="photos/3.jpg"; arr[3]="photos/4.jpg"; arr[4]="photos/5.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> <img id=obj src ="photos/1.jpg" width=200 height=150 border =0> 可以自己配置,自己設置每張圖片切換的時間間隔,自己設置每張圖片的路徑(絕對、相對路徑都可以)雖然很簡單,但是很實用。 ------------------------------------------------------------- 第二種方法: //修改圖片的寬度、高度,注意要和下面的一樣,修改顯示位置 <style type="text/css"> #img1 {position:absolute; width:140px; height:105px; left:220px; top:125px; z-index:1; visibility:hidden;} #img2 {position:absolute; width:140px; height:105px; left:220px; top:125px; z-index:2} </style> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin var ie5=(document.getElementById && document.all); var ns6=(document.getElementById && !document.all);

『捌』 Java實現多種幻燈片切換特效(附源碼)

功能說明 代碼實現了多種幻燈片變換特效 如 淡入淡出 緩慢覆蓋 旋轉覆蓋等 多種變換效果

功能實現

圖片載入類ImageLoader實現

)用阻塞隊列存儲要圖片 BlockingQueue images = new ArrayBlockingQueue<>( )

)用圖片eof表示圖片隊列結束 Image eof = new WritableImage( )

)循環讀取指定圖片 由於是阻塞隊列 所以當隊列滿的時候線程會自動阻塞

public void run() {

int id = ;

try {

while (true) {

String path = resources[id];

InputStream is = getClass() getResourceAsStream(path)

if (is != null) {

Image image = new Image(is width height true true)

if (!image isError()) {

images put(image)

}

}

id++;

if (id >= resources length) {

id = ;

}

}

} catch (Exception e) {

} finally {

if (!cancelled) {

try {

images put(eof)

} catch (InterruptedException e) {

}

}

}

}

特效實現 以弧形切換圖片為例 首先定義LengthTransition變化特效 設置變化時間 以及弧度數跟時間的變化關系

class LengthTransition extends Transition {

Arc arc;

public LengthTransition(Duration d Arc arc) {

this arc = arc;

setCycleDuration(d)

}

@Override

protected void interpolate(double d) {

arc setLength(d * )

}

}

然後設置圖片層疊效果

group setBlendMode(BlendMode SRC_OVER)

next setBlendMode(BlendMode SRC_ATOP)

以及之前那張圖片的淡出特效

FadeTransition ft = new FadeTransition(Duration seconds( ) mask )

最後同時執行這兩個特效

ParallelTransition pt = new ParallelTransition(lt ft)

效果圖

熱點內容
加密loadrunner 發布:2025-05-10 17:08:46 瀏覽:352
ftp默認使用埠是8080 發布:2025-05-10 17:04:28 瀏覽:274
安卓美團我的評價在哪裡 發布:2025-05-10 17:03:55 瀏覽:215
銀行推薦演算法 發布:2025-05-10 16:57:21 瀏覽:643
2014年二級c語言真題 發布:2025-05-10 16:56:25 瀏覽:181
絕地求生進不去顯示伺服器已滿怎麼辦 發布:2025-05-10 16:56:21 瀏覽:91
存儲系統安裝工程師 發布:2025-05-10 16:53:38 瀏覽:710
php搜索分詞 發布:2025-05-10 16:53:29 瀏覽:546
8位加密 發布:2025-05-10 16:51:01 瀏覽:651
免費nvr伺服器搭建 發布:2025-05-10 16:45:20 瀏覽:847