【发布时间】:2011-10-27 12:52:01
【问题描述】:
我写了这个函数来改变我的图片有什么问题? 我的目标是,如果单击显示图像 p,则单击 2 个图像之间的图像切换显示图像 p1
我在脚本中有这个:
<script>
function changeimage()
{
if(this.getElementById('myimage').src=="../../images/p1.gif")
{
document.getElementById('myimage').src="../../images/p.gif";
}
else
{
document.getElementById('myimage').src="../../images/p1.gif";
}
}
</script>
在 html 部分,我有这些不止一张图片,但我将它们全部设置为 Id=myimage 设置整个同一个 ID 是否错误?:
<table width="100%">
<tr>
<td><img id='myimage' src="../../images/p1.gif" onclick="changeimage();setTable('table2');setTable('table2-2');check('table3');check('table3-3');check('table3-3-3');check('table4');check('table5');check('table6');check('table6-1');"></td>
<td style="font-weight: bold;font-size:13; font-family:arial,verdana;" width="25%">General Rule Options</td>
<td valign="bottom" width="100%">
我的表格中有很多这样的行
【问题讨论】:
-
怎么了?发生什么了?你在哪里调用函数?
-
请告诉我哪里错了!我的表格和 html 中有图片!
-
因为你没有提供足够的细节。
-
Slaks 和其他人请不要投票给我吗?投票后对我来说是有风险的,我不能再提问了
-
@Negin:那么你应该学习如何提出更好的问题。始终添加尽可能多的细节,发布您收到的任何错误消息。要求人们不要对糟糕的问题投反对票可能会让你获得更多的反对票。
标签: javascript