当更改输入类型=无线电输入类型=图像不起作用时

时间:2015-09-30 15:00:06

标签: html

美好的一天,我正在尝试替换此代码

<input type=radio name="y" value="1" onclick="this.form.submit()">work
<input type=radio name="n" value="1" onclick="this.form.submit()">broken

使用此代码

<input type=image name="y" value="1" onclick="this.form.submit()"><img src="/ar/serials/images/work.png">
<input type=image name="n" value="1" onclick="this.form.submit()"><img src="/ar/serials/images/broken.png">

但提交不起作用(单击图像时不会发生任何事情)

2 个答案:

答案 0 :(得分:0)

您可以将src属性直接添加到输入标记中。

示例:

<input type=image name="y" value="1" onclick="this.form.submit()" src="/ar/serials/images/work.png"/>

答案 1 :(得分:0)

我设置了这段代码,我的问题已经解决了

  <input type=submit name="y" value="1" onclick="this.form.submit()" title='press here if the Serial works' style="background-color: black; border: 0px solid #900; background: url(/ar/serials/images/work.png) repeat-x; width:100px; height:40px; margin-left: 50px;">
  <input type=submit name="n" value="1" onclick="this.form.submit()" title='press here if the Serial not works' style="background-color: black; border: 0px solid #900; background: url(/ar/serials/images/broken.png) repeat-x; width:124px; height:40px;"><?php } else{echo "<font size='5' color='#33FFFF' face='arial'>"; echo "Thank you for Rating this Serial!";}?></td></form>

但还有一个问题,我可以在style =“”中添加代码来更改onmouseover和onmouseout上的背景图片吗?