⑴ 怎么让图片在网页里自动播放
那是一个java的图片切换代码,您可以在那些网页的原代码里面找到。
一般循环的图片不超过五张。当然超过是可以的只是要一行一行去写,比较麻烦。代码就不帖了,如果没有从网站里面拷贝出来,也可以加我的QQ来找我。
⑵ 关于菜鸟的javascript.... 我自学了javascript,懂了一点点 今天自己上网看了一些图片切换的特效
额 给你讲讲思路吧:
1、首先用html写出图片标签img和展示图片的区域div
2、为每张图片注册事件侦听器mouseover,当鼠标移动到该图片时,触发事件侦听器(也就是相应的js函数),获得图片的地址,然后将展示区域的 img.src修改成当前获得的地址即可。
剩下的就是实现了。。。写了个 你看看,要运行,把里面的图片,换成你电脑里的就行了
<!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=utf-8" />
<title>无标题文档</title>
</head>
<style>
#showImg{
width:200px;
height:200px;
border:#000000 1px solid;
}
</style>
<body>
<div id="imgs">
<img src="png-0001.png" />
<img src="png-0002.png" />
<img src="png-0003.png" />
<img src="png-0004.png" />
</div>
<div id="showDiv">
<img id='showImg' src="png-0001.png" />
</div>
</body>
<script language="javascript">
function initImg()
{
var imgs=document.getElementById('imgs').getElementsByTagName('img');//返回一个img集合的数组
for(var i=0;i<imgs.length;i++)
{
var path=imgs[i].src;//获得图片路径
show(imgs[i],path);
}
}
function show(img,path)
{
var imgObject=new Image();
imgObject.src=path;
var showImg=document.getElementById('showImg');
if(img.addEventListener)//w3c标准 添加事件侦听器(事件触发函数)方式
{
img.addEventListener('mouseover',function(){showImg.src=imgObject.src;},false);
}
else //IE添加事件侦听器(事件触发函数)方式
{
img.attachEvent('onmouseover',function(){showImg.src=imgObject.src;});
}
}
window.onload=initImg;
</script>
</html>
⑶ 在网页中图片切换时如何达到向PPT幻灯片中的各种切换效果啊
简单的用java脚本做,复杂的就得flash了
<table width="806" border="0" align="center" cellpadding="0" cellspacing="0" dwtype="CopyTableCell">
<tr background="../images/banner0.jpg">
<td height="52" colspan="2" align="center" valign="top" background="../images/gg1.jpg"><script language="JavaScript1.2" type="text/javascript">
var slideshow_width='806px'
var slideshow_height='216px'
var pause=2000
var fadeimages=new Array()
fadeimages[0]="images/banner2.jpg"
fadeimages[1]="images/banner1.jpg"
fadeimages[2]="images/banner3.jpg"
//// < Shafeeq > /////////////
var preloadedimages=new Array()
for (p=0;p<fadeimages.length;p++){
preloadedimages[p]=new Image()
preloadedimages[p].src=fadeimages[p]
}
var ie4=document.all
var dom=document.getElementById
if (ie4||dom)
document.write('<div style="position:relative;width:'+slideshow_width+';height:'+slideshow_height+';overflow:hidden"><div id="canvas0" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;left:0;filter:alpha(opacity=10);-moz-opacity:10"></div><div id="canvas1" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;left:0;filter:alpha(opacity=10);-moz-opacity:10;visibility: hidden"></div></div>')
else
document.write('<img name="defaultslide" src="'+fadeimages[0]+'">')
var curpos=10
var degree=10
var curcanvas="canvas0"
var curimageindex=0
var nextimageindex=1
function fadepic(){
if (curpos<100){
curpos+=10
if (tempobj.filters)
tempobj.filters.alpha.opacity=curpos
else if (tempobj.style.MozOpacity)
tempobj.style.MozOpacity=curpos/101
}
else{
clearInterval(dropslide)
nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj.innerHTML='<img src="'+fadeimages[nextimageindex]+'">'
nextimageindex=(nextimageindex<fadeimages.length-1)? nextimageindex+1 : 0
var tempobj2=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj2.style.visibility="hidden"
setTimeout("rotateimage()",pause)
}
}
function rotateimage(){
if (ie4||dom){
resetit(curcanvas)
var crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.style.zIndex++
tempobj.style.visibility="visible"
var temp='setInterval("fadepic()",50)'
dropslide=eval(temp)
curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
}
else
document.images.defaultslide.src=fadeimages[curimageindex]
curimageindex=(curimageindex<fadeimages.length-1)? curimageindex+1 : 0
}
function resetit(what){
curpos=10
var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
if (crossobj.filters)
crossobj.filters.alpha.opacity=curpos
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=curpos/101
}
function startit(){
var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.innerHTML='<img src="'+fadeimages[curimageindex]+'">'
rotateimage()
}
if (ie4||dom)
window.onload=startit
else
setInterval("rotateimage()",pause)
</script> </td>
</tr>
</table>