Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用javascript更改图像_Javascript_Html_Image - Fatal编程技术网

使用javascript更改图像

使用javascript更改图像,javascript,html,image,Javascript,Html,Image,我想更改单击时的图像箭头,目前我有这个,但单击时更改了当前图像,但不隐藏- <a id="Boton1" class="button" onClick="showHide()" href="javascript:void"><center> Lípidos<br> <img src="http://sakapa.itmui.com/todo/www/img/flecha_abajo.png" width="24" height="13

我想更改单击时的图像箭头,目前我有这个,但单击时更改了当前图像,但不隐藏-

 <a id="Boton1" class="button" onClick="showHide()" href="javascript:void"><center>
    Lípidos<br>
     <img src="http://sakapa.itmui.com/todo/www/img/flecha_abajo.png" width="24" height="13" alt=""/>
  </center></a>

您的图像箭头没有任何ID

您需要提供一个id,例如

<img id="flecha_abajo" />

我的建议是使用css类来显示/隐藏,而不是试图检查和更改特定的css属性也可以显示showHide()函数吗?代码笔链接中的hi@BillBokeey是的,但是,当我再次单击时,不要更改为原始箭头,我想做一些类似于如果单击了向下箭头,则更改为向上箭头,如果单击了向上箭头,则更改为向下箭头arrow@alsuelo,我宁愿操纵图像src…如下所示:如果它不回变,那是因为您需要绘制style.display none:)例如….style.display=“”;Nervermind我想你的代码会在用户每次点击箭头时一次又一次地下载图片。。。非常感谢,我知道if有什么问题了
document.getElementById("flecha_abajo").style.display = none;