我有以下输入按钮代码。发生提交后,如何修改此代码以使用名为btn_nxt.png_hold.gif
的按钮的灰色版本?onSubmit javascript窗体事件换出图像?
<input onsubmit="this.disabled=true;return true;" type="image" name="Insert" id="Insert" value="Insert" alt="Insert" src="images/btn_nxt.png" />
我有以下输入按钮代码。发生提交后,如何修改此代码以使用名为btn_nxt.png_hold.gif
的按钮的灰色版本?onSubmit javascript窗体事件换出图像?
<input onsubmit="this.disabled=true;return true;" type="image" name="Insert" id="Insert" value="Insert" alt="Insert" src="images/btn_nxt.png" />
您需要更改的图片单击该按钮时:
onclick="this.src='images/btn_nxt.png_hold.gif';"
的onsubmit
只属于表单元素。
我已经有一个onclick事件...是否有另一个事件,我可以使用onClick后发生火灾? –
@Rocco不需要另一个事件,只需将'this.src = ...'添加到现有的'onclick'事件。 –
onclick="this.src='images/btn_nxt.png_hold.gif';this.disabled=true;"
propper解决方案是在提交时向按钮添加一个类。使用样式表,您可以对您喜欢的按钮进行任何修改。
你也可以用jQuery来操纵它。它更干净。
$("#Insert").live("click", function(){
$(this).attr("src","path/tp/image.gif").attr("disabled", "disabled");
});
希望它有帮助。
代码在哪? –
onsubmit =“this.disabled = true; return true;” –
@ShadowWizard这是不正确的,我没有直接思考,当我发现它已经回答了这个问题,所以我删除它:) –