【问题标题】:Swap_Image function not working properlySwap_Image 功能无法正常工作
【发布时间】:2012-01-03 07:00:43
【问题描述】:

大家好,我正在使用 netbeans 和 Mysql 和 apache tomcat 服务器开发一个 Web 应用程序。我正在使用 jsp 文件。出于某种目的,我编写了类似

的代码
  <TBODY>
                        <TR vAlign=top>
                        <TD width=15 height="23"><IMG height=19 src="images/r1_107.gif" 
                    width=15></TD>

                          <TD width=50><div align="center"><a 
                    onMouseOver="MM_swapImage('Image21','','images/home_207.gif',1)" 
                    onMouseOut=MM_swapImgRestore() 
                    href="newjsp.jsp"><img 
                    height=19 src="images/home_107.gif" width=50 
                    border=0 name=Image21></a></div></TD>

但是交换图像功能不起作用。你能解释一下交换图像功能的作用以及我的代码有什么问题吗?我在使用 MM_swapimage 函数 jst explian me 函数及其参数时遇到了一些问题

【问题讨论】:

    标签: java mysql netbeans


    【解决方案1】:

    javascript 函数 swap_image() 的代码在哪里?

    除非您显示 swap_image 函数,否则无法回答。

    【讨论】:

    • 我已经在其中包含了自己的代码...代码就像 onMouseOver="MM_swapImage('Image21','','images/home_207.gif',1)" onMouseOut=MM_swapImgRestore()
    • 我的图像文件夹中有 home_207.gif 图像。但我没有 Image21。你能解释一下那个Image21是什么吗??
    【解决方案2】:

    好吧,您粘贴的代码不是很明显。你到底想做什么?

    如果您想使用 javascript 更改图像的 src,请执行以下操作-

    <img src="image123.gif" id="topImage" onclick="changeImageSource(this, 'images/img21.gif')"/>
    

    在 javascript 方面,

    function changeImageSource(imgElement, newImageSource) {
        imgElement.src = newImageSource;
    }
    

    【讨论】:

    • 我希望当我将鼠标悬停在图像上时图像应该发生变化。为此,我在 netbeans 中使用 jsp 页面
    猜你喜欢
    • 2017-09-23
    • 2013-11-06
    • 2013-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多