我们的目标是:

代码:
js美术馆function showPic(whichpic)
{
var source=whichpic.getAttribute("href");
var placeholder= document.getElementById("placeholder");
placeholder.setAttribute("src",source);
}
.wrap{
width:1000px;
margin:0 auto;
}
.place{
margin:0 auto;
text-align:center;
}
.table{
width:1000px;
height:27px;
margin-bottom:10px;
}
.table li{
float:left;
line-height:27px;
list-style-type: none;
width: 100px;
font-family: "微软雅黑";
text-align: center;
}
效果如下:

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
本文介绍了如何使用JavaScript实现图片展示功能,通过获取元素、设置属性来改变占位符图片的源,达到切换图片的效果。代码示例中涉及HTML、CSS和JavaScript的交互,适合前端开发者学习。


2595

被折叠的 条评论
为什么被折叠?



