JavaScript显示图片问题 一个table,4行2列,左侧为4行,右侧合并为1行1列。鼠标悬停在第1列1行中的一个图片,然后在第2列中显示另一个设定好的图片,然后再悬停第1列2行的图片,然后在第2列中显示。怎么做?用JavaScript怎么做? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!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> <title> new document </title> <style type="text/css"> table { border: 3px solid #BFBFBF; border-collapse: collapse; padding:0px; margin: 0px; } td { border: 3px solid #BFBFBF; } img { width:134px; } #oshow { width: 300px; } #showImg { width:300px; height: 400px; } </style> <script type="text/javascript"> <!-- function showImg(oTd){ document.getElementById("oshow").firstChild.src = oTd.firstChild.src; } //--> </script> </head> <body> <table> <tr> <td onmouseover = "showImg(this)"><img src="http://tbn0.google.cn/images?q=tbn:un4M5zABTAzLlM:"/></td> <td rowspan="4" id="oshow"><img id="showImg" src="http://tbn0.google.cn/images?q=tbn:un4M5zABTAzLlM:"></td> </tr> <tr> <td onmouseover = "showImg(this)"><img src="http://tbn0.google.cn/images?q=tbn:qjuDn5e97wNQGM:"/></td> </tr> <tr> <td onmouseover = "showImg(this)"><img src="http://tbn0.google.cn/images?q=tbn:lthIA6WGBSR_eM:"/></td> </tr> <tr> <td onmouseover = "showImg(this)"><img src="http://tbn0.google.cn/images?q=tbn:vbkQPFYOduuMYM:"/></td> </tr> </table> </body></html> <body><script language="javascript"><!--var imgonload=function(){img=document.getElementById("img")}//--></script><table border="1" width="400" id="table1"> <tr> <td width="80" height="50" onmouseover="img.src='http://desk.blueidea.com/desk/XP/225/xpbz0091.jpg'"><img height=50 width=80 src='http://desk.blueidea.com/desk/XP/225/xpbz0091.jpg'></td> <td rowspan="4"><img id=img height=200 width=300 src='http://desk.blueidea.com/desk/XP/225/xpbz0091.jpg'></td> </tr> <tr> <td width="80" height="50" onmouseover="img.src='http://desk.blueidea.com/desk/XP/225/xpbz0092.jpg'"><img height=50 width=80 src='http://desk.blueidea.com/desk/XP/225/xpbz0092.jpg'></td> </tr> <tr> <td width="80" height="50" onmouseover="img.src='http://desk.blueidea.com/desk/XP/225/xpbz0093.jpg'"><img height=50 width=80 src='http://desk.blueidea.com/desk/XP/225/xpbz0093.jpg'></td> </tr> <tr> <td width="80" height="50" onmouseover="img.src='http://desk.blueidea.com/desk/XP/225/xpbz0094.jpg'"><img height=50 width=80 src='http://desk.blueidea.com/desk/XP/225/xpbz0094.jpg'></td> </tr></table></body> or:<body><script language="javascript"><!--var imgonload=function(){img=document.getElementById("img")}//--></script><table border="1" width="400" id="table1"> <tr> <td width="80" height="50"><img onmouseover="img.src=this.bigsrc" height=50 width=80 src='http://desk.blueidea.com/desk/XP/225/xpbz0091.jpg' bigsrc='http://desk.blueidea.com/desk/XP/225/xpbz0091.jpg'></td> <td rowspan="4"><img id=img height=200 width=300 src='http://desk.blueidea.com/desk/XP/225/xpbz0091.jpg'></td> </tr> <tr> <td width="80" height="50"><img onmouseover="img.src=this.bigsrc" height=50 width=80 src='http://desk.blueidea.com/desk/XP/225/xpbz0092.jpg' bigsrc='http://desk.blueidea.com/desk/XP/225/xpbz0092.jpg'></td> </tr> <tr> <td width="80" height="50"><img onmouseover="img.src=this.bigsrc" height=50 width=80 src='http://desk.blueidea.com/desk/XP/225/xpbz0093.jpg' bigsrc='http://desk.blueidea.com/desk/XP/225/xpbz0093.jpg'></td> </tr> <tr> <td width="80" height="50"><img onmouseover="img.src=this.bigsrc" height=50 width=80 src='http://desk.blueidea.com/desk/XP/225/xpbz0094.jpg' bigsrc='http://desk.blueidea.com/desk/XP/225/xpbz0094.jpg'></td> </tr></table></body> <script language="javascript">function show_detail(img){ var table = document.getElementById("table1"); var img2 = table.rows[0].cells[1].getElementsByTagName("img")[0]; if(!img2) { img2 = document.createElement("img"); table.rows[0].cells[1].appendChild(img2); } img2.src = img.getAttribute("detail");}</script><table border="1" width="400" id="table1"> <tr> <td><img src="http://img02.taobaocdn.com/bao/uploaded/i2/2c1/780/T1gNBaXft6DAzvR0jA.jpg_sum.jpg" detail="http://img02.taobaocdn.com/bao/uploaded/i2/2c1/780/T1gNBaXft6DAzvR0jA.jpg" onmouseover="show_detail(this)"/></td> <td rowspan="4"></td> </tr> <tr> <td><img src="http://img04.taobaocdn.com/bao/uploaded/i4/T1HUNbXaNlkwD1upjX.jpg_sum.jpg" detail="http://img04.taobaocdn.com/bao/uploaded/i4/T1HUNbXaNlkwD1upjX.jpg" onmouseover="show_detail(this)"/></td> </tr> <tr> <td><img src="http://img02.taobaocdn.com/bao/uploaded/i2/T19lxbXoVr9Mz1upjX.jpg_sum.jpg" detail="http://img02.taobaocdn.com/bao/uploaded/i2/T19lxbXoVr9Mz1upjX.jpg" onmouseover="show_detail(this)"/></td> </tr> <tr> <td><img src="http://img02.taobaocdn.com/bao/uploaded/i2/2c1/780/T1gNBaXft6DAzvR0jA.jpg_sum.jpg" detail="http://img02.taobaocdn.com/bao/uploaded/i2/2c1/780/T1gNBaXft6DAzvR0jA.jpg" onmouseover="show_detail(this)"/></td> </tr></table>代码在IE6和Firefox下测试通过 <script language="javascript">function show_detail(img){ var table = document.getElementById("table1"); var img2 = table.rows[0].cells[1].getElementsByTagName("img")[0]; if(!img2) { img2 = document.createElement("img"); table.rows[0].cells[1].appendChild(img2); } img2.src = img.getAttribute("detail");}</script><table border="1" width="400" id="table1"> <tr> <td><img src="http://img02.taobaocdn.com/bao/uploaded/i2/2c1/780/T1gNBaXft6DAzvR0jA.jpg_sum.jpg" detail="http://img02.taobaocdn.com/bao/uploaded/i2/2c1/780/T1gNBaXft6DAzvR0jA.jpg" onmouseover="show_detail(this)"/></td> <td rowspan="4"></td> </tr> <tr> <td><img src="http://img04.taobaocdn.com/bao/uploaded/i4/T1HUNbXaNlkwD1upjX.jpg_sum.jpg" detail="http://img04.taobaocdn.com/bao/uploaded/i4/T1HUNbXaNlkwD1upjX.jpg" onmouseover="show_detail(this)"/></td> </tr> <tr> <td><img src="http://img02.taobaocdn.com/bao/uploaded/i2/T19lxbXoVr9Mz1upjX.jpg_sum.jpg" detail="http://img02.taobaocdn.com/bao/uploaded/i2/T19lxbXoVr9Mz1upjX.jpg" onmouseover="show_detail(this)"/></td> </tr> <tr> <td><img src="http://img02.taobaocdn.com/bao/uploaded/i2/2c1/780/T1gNBaXft6DAzvR0jA.jpg_sum.jpg" detail="http://img02.taobaocdn.com/bao/uploaded/i2/2c1/780/T1gNBaXft6DAzvR0jA.jpg" onmouseover="show_detail(this)"/></td> </tr></table>是不是改用html格式? #4:<img onmouseover="img.src=this.bigsrc" height=50 width=80 src='http://desk.blueidea.com/desk/XP/225/xpbz0091.jpg' bigsrc='http://desk.blueidea.com/desk/XP/225/xpbz0091.jpg'>改写bigsrc 谁知道什么日历显示的js成品呀~~希望大家推荐个~ A标签跳转后样式问题!!!!!急, 简单文字滚动 几点不明白 请问一个JS中层的问题? IE8调试模式对话框的问题 如何获得file上传的按钮的文字? 如何在一个页面中播放多个视频? 如何解开对 IE浏览器 window.open的限制 谁能写出在26个字母和10个数字中随机抽出1到n个字符加上一个固定字符串的所有组合的代码!! 请问关于控制打印样式的问题 如何使这个静态分页后的<OL>不改变行号 onchange代码为何无效呢?
<!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>
<title> new document </title>
<style type="text/css">
table { border: 3px solid #BFBFBF;
border-collapse: collapse;
padding:0px;
margin: 0px;
} td {
border: 3px solid #BFBFBF; }
img {
width:134px; } #oshow {
width: 300px;
} #showImg {
width:300px;
height: 400px;
}
</style>
<script type="text/javascript">
<!--
function showImg(oTd){
document.getElementById("oshow").firstChild.src = oTd.firstChild.src;
}
//-->
</script>
</head> <body>
<table>
<tr>
<td onmouseover = "showImg(this)"><img src="http://tbn0.google.cn/images?q=tbn:un4M5zABTAzLlM:"/></td>
<td rowspan="4" id="oshow"><img id="showImg" src="http://tbn0.google.cn/images?q=tbn:un4M5zABTAzLlM:"></td>
</tr>
<tr>
<td onmouseover = "showImg(this)"><img src="http://tbn0.google.cn/images?q=tbn:qjuDn5e97wNQGM:"/></td> </tr>
<tr>
<td onmouseover = "showImg(this)"><img src="http://tbn0.google.cn/images?q=tbn:lthIA6WGBSR_eM:"/></td> </tr>
<tr>
<td onmouseover = "showImg(this)"><img src="http://tbn0.google.cn/images?q=tbn:vbkQPFYOduuMYM:"/></td> </tr>
</table>
</body>
</html>
<body>
<script language="javascript">
<!--
var img
onload=function(){img=document.getElementById("img")}
//-->
</script>
<table border="1" width="400" id="table1">
<tr>
<td width="80" height="50" onmouseover="img.src='http://desk.blueidea.com/desk/XP/225/xpbz0091.jpg'"><img height=50 width=80 src='http://desk.blueidea.com/desk/XP/225/xpbz0091.jpg'></td>
<td rowspan="4"><img id=img height=200 width=300 src='http://desk.blueidea.com/desk/XP/225/xpbz0091.jpg'></td>
</tr>
<tr>
<td width="80" height="50" onmouseover="img.src='http://desk.blueidea.com/desk/XP/225/xpbz0092.jpg'"><img height=50 width=80 src='http://desk.blueidea.com/desk/XP/225/xpbz0092.jpg'></td>
</tr>
<tr>
<td width="80" height="50" onmouseover="img.src='http://desk.blueidea.com/desk/XP/225/xpbz0093.jpg'"><img height=50 width=80 src='http://desk.blueidea.com/desk/XP/225/xpbz0093.jpg'></td>
</tr>
<tr>
<td width="80" height="50" onmouseover="img.src='http://desk.blueidea.com/desk/XP/225/xpbz0094.jpg'"><img height=50 width=80 src='http://desk.blueidea.com/desk/XP/225/xpbz0094.jpg'></td>
</tr>
</table></body>
<script language="javascript">
<!--
var img
onload=function(){img=document.getElementById("img")}
//-->
</script>
<table border="1" width="400" id="table1">
<tr>
<td width="80" height="50"><img onmouseover="img.src=this.bigsrc" height=50 width=80 src='http://desk.blueidea.com/desk/XP/225/xpbz0091.jpg' bigsrc='http://desk.blueidea.com/desk/XP/225/xpbz0091.jpg'></td>
<td rowspan="4"><img id=img height=200 width=300 src='http://desk.blueidea.com/desk/XP/225/xpbz0091.jpg'></td>
</tr>
<tr>
<td width="80" height="50"><img onmouseover="img.src=this.bigsrc" height=50 width=80 src='http://desk.blueidea.com/desk/XP/225/xpbz0092.jpg' bigsrc='http://desk.blueidea.com/desk/XP/225/xpbz0092.jpg'></td>
</tr>
<tr>
<td width="80" height="50"><img onmouseover="img.src=this.bigsrc" height=50 width=80 src='http://desk.blueidea.com/desk/XP/225/xpbz0093.jpg' bigsrc='http://desk.blueidea.com/desk/XP/225/xpbz0093.jpg'></td>
</tr>
<tr>
<td width="80" height="50"><img onmouseover="img.src=this.bigsrc" height=50 width=80 src='http://desk.blueidea.com/desk/XP/225/xpbz0094.jpg' bigsrc='http://desk.blueidea.com/desk/XP/225/xpbz0094.jpg'></td>
</tr>
</table></body>
function show_detail(img)
{
var table = document.getElementById("table1");
var img2 = table.rows[0].cells[1].getElementsByTagName("img")[0];
if(!img2)
{
img2 = document.createElement("img");
table.rows[0].cells[1].appendChild(img2);
}
img2.src = img.getAttribute("detail");
}
</script>
<table border="1" width="400" id="table1">
<tr>
<td><img src="http://img02.taobaocdn.com/bao/uploaded/i2/2c1/780/T1gNBaXft6DAzvR0jA.jpg_sum.jpg" detail="http://img02.taobaocdn.com/bao/uploaded/i2/2c1/780/T1gNBaXft6DAzvR0jA.jpg" onmouseover="show_detail(this)"/></td>
<td rowspan="4"></td>
</tr>
<tr>
<td><img src="http://img04.taobaocdn.com/bao/uploaded/i4/T1HUNbXaNlkwD1upjX.jpg_sum.jpg" detail="http://img04.taobaocdn.com/bao/uploaded/i4/T1HUNbXaNlkwD1upjX.jpg" onmouseover="show_detail(this)"/></td>
</tr>
<tr>
<td><img src="http://img02.taobaocdn.com/bao/uploaded/i2/T19lxbXoVr9Mz1upjX.jpg_sum.jpg" detail="http://img02.taobaocdn.com/bao/uploaded/i2/T19lxbXoVr9Mz1upjX.jpg" onmouseover="show_detail(this)"/></td>
</tr>
<tr>
<td><img src="http://img02.taobaocdn.com/bao/uploaded/i2/2c1/780/T1gNBaXft6DAzvR0jA.jpg_sum.jpg" detail="http://img02.taobaocdn.com/bao/uploaded/i2/2c1/780/T1gNBaXft6DAzvR0jA.jpg" onmouseover="show_detail(this)"/></td>
</tr>
</table>
代码在IE6和Firefox下测试通过
<script language="javascript">
function show_detail(img)
{
var table = document.getElementById("table1");
var img2 = table.rows[0].cells[1].getElementsByTagName("img")[0];
if(!img2)
{
img2 = document.createElement("img");
table.rows[0].cells[1].appendChild(img2);
}
img2.src = img.getAttribute("detail");
}
</script>
<table border="1" width="400" id="table1">
<tr>
<td><img src="http://img02.taobaocdn.com/bao/uploaded/i2/2c1/780/T1gNBaXft6DAzvR0jA.jpg_sum.jpg" detail="http://img02.taobaocdn.com/bao/uploaded/i2/2c1/780/T1gNBaXft6DAzvR0jA.jpg" onmouseover="show_detail(this)"/></td>
<td rowspan="4"></td>
</tr>
<tr>
<td><img src="http://img04.taobaocdn.com/bao/uploaded/i4/T1HUNbXaNlkwD1upjX.jpg_sum.jpg" detail="http://img04.taobaocdn.com/bao/uploaded/i4/T1HUNbXaNlkwD1upjX.jpg" onmouseover="show_detail(this)"/></td>
</tr>
<tr>
<td><img src="http://img02.taobaocdn.com/bao/uploaded/i2/T19lxbXoVr9Mz1upjX.jpg_sum.jpg" detail="http://img02.taobaocdn.com/bao/uploaded/i2/T19lxbXoVr9Mz1upjX.jpg" onmouseover="show_detail(this)"/></td>
</tr>
<tr>
<td><img src="http://img02.taobaocdn.com/bao/uploaded/i2/2c1/780/T1gNBaXft6DAzvR0jA.jpg_sum.jpg" detail="http://img02.taobaocdn.com/bao/uploaded/i2/2c1/780/T1gNBaXft6DAzvR0jA.jpg" onmouseover="show_detail(this)"/></td>
</tr>
</table>
是不是改用html格式?
<img onmouseover="img.src=this.bigsrc" height=50 width=80 src='http://desk.blueidea.com/desk/XP/225/xpbz0091.jpg' bigsrc='http://desk.blueidea.com/desk/XP/225/xpbz0091.jpg'>
改写bigsrc