如图所示,我想请教一下,如何实现 鼠标放在左边 1-4上后,分别在右边空白处显示不同的图片呢?这段代码该怎么写? 谢谢

解决方案 »

  1.   

    可以用js来做,以下是两个例子鼠标经过时改变颜色
     
    <script language="JavaScript1.2">
    function changeto(highlightcolor){
    source=event.srcElement
    if (source.tagName=="TR"||source.tagName=="TABLE")
    return
    while(source.tagName!="TD")
    source=source.parentElement
    if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
    source.style.backgroundColor=highlightcolor
    }function changeback(originalcolor){
    if (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")
    return
    if (event.toElement!=source)
    source.style.backgroundColor=originalcolor
    }
    </script><!--以下是你代码是用来触发事件的,也是改变颜色的地方-->
    <table border="1" width="54%">
      <tr onMouseover="changeto('#fff362')" onMouseout="changeback('white')">
        <td width="100%"> </td>
      </tr>
      <tr onMouseover="changeto('#ff5525')" onMouseout="changeback('white')">
        <td width="100%"> </td>
      </tr>
      <tr onMouseover="changeto('#ff2262')" onMouseout="changeback('white')">
        <td width="100%"> </td>
      </tr>
    </table>
      

  2.   

    鼠标驱动图片变化<SCRIPT language="JavaScript">
    <!-- Begin
    function movepic(img_name,img_src) {
    document[img_name].src=img_src;
    }
    // End -->
    </SCRIPT>
    <A HREF="http://wd365.nease.net" 
    onmouseover="movepic('button','tp2.gif')" 
    onmouseout="movepic('button','tp3.gif')">
    <IMG NAME="button" SRC="tp1.gif" ALT="Image"></A>