Html 将图像设置为提交按钮

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1994406/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 01:44:31  来源:igfitidea点击:

set image as submit button

htmlwebforms

提问by Muhammad Hussain

i am using following code to set an image as submit button

我正在使用以下代码将图像设置为提交按钮

 *<input type="submit" src="submit1.jpg" alt="submit Button"onMouseOver="this.src='submit1.jpg'">*

but i actually did not know at which place in whole code to put this line of code because i put it after but it is not working

但我实际上不知道在整个代码的哪个位置放置这行代码,因为我把它放在后面但它不起作用

at which place i put this code there appear "submit query" but i want it to submit query at buuto i also use

我把这段代码放在哪个地方出现“提交查询”,但我希望它在 buuto 提交查询,我也使用

input type="image"

actually i want to ask from which place i start this code "from which line?"

实际上我想问从哪个地方开始这个代码“从哪一行?”

回答by DoctorLouie

Change type from input to image and add value as submit:

将类型从输入更改为图像并在提交时添加值:


<input type="image" value="submit" src="submit1.jpg" alt="submit Button" onMouseOver="this.src='submit1.jpg'">

回答by alemjerus

This is complete HTML document:

这是完整的 HTML 文档:

<form name="someform" action="http://www.google.com">
<input type="image" width="100" value="submit" src="image1.png" alt="submit Button" onMouseOut="this.src='image1.png'" onMouseOver="this.src='image2.png'">
</form>

Note that "onmouseout" event is used to bring the button to previous form when mouse is not over

请注意,当鼠标未悬停时,“onmouseout”事件用于将按钮带到上一个表单