I have two image-type buttons on my page:
我的页面上有两个图像类型按钮:
<input type="image" src="logg.png" name="saveForm" class="btTxt submit" id="saveForm" />
<input type="image" src="logg.png" name="saveForm1" class="btTxt submit" id="saveForm1" />
The problem is that the buttons' image doesn't load up. When I get rid of one of the buttons, though, everything is fine. The buttons have different names and IDs, what's the problem?
问题是按钮的图像没有加载。但是,当我摆脱其中一个按钮时,一切都很好。按钮有不同的名称和ID,问题是什么?
2 个解决方案
#1
1
You're missing the ALT values. These are needed incase the image can't be loaded: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input
你错过了ALT值。如果无法加载图像,则需要这些:https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input
Here's an alternative approach:
这是另一种方法:
Create two <buttons>
or <input type="submit">
and style their backgrounds using css.
创建两个
If your goal is to submit the png image in the form, there's a similar answer here: <button> background image
如果你的目标是在表单中提交png图像,那么这里有一个类似的答案:
#2
0
Check if the image source location is valid and the image is available in the location where the browser is searching for. Check that by right clicking on the image button, use option Inspect element
(available only in higher versions of browsers) and check for the source location for the image.
检查图像源位置是否有效,并且图像在浏览器搜索的位置可用。通过右键单击图像按钮检查是否使用选项Inspect元素(仅在更高版本的浏览器中可用)并检查图像的源位置。
In ur case the image should be available on the same folder where the html is available.
在大多数情况下,图像应该在html可用的同一文件夹中可用。
Check for typo errors.
检查拼写错误。
#1
1
You're missing the ALT values. These are needed incase the image can't be loaded: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input
你错过了ALT值。如果无法加载图像,则需要这些:https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input
Here's an alternative approach:
这是另一种方法:
Create two <buttons>
or <input type="submit">
and style their backgrounds using css.
创建两个
If your goal is to submit the png image in the form, there's a similar answer here: <button> background image
如果你的目标是在表单中提交png图像,那么这里有一个类似的答案:
#2
0
Check if the image source location is valid and the image is available in the location where the browser is searching for. Check that by right clicking on the image button, use option Inspect element
(available only in higher versions of browsers) and check for the source location for the image.
检查图像源位置是否有效,并且图像在浏览器搜索的位置可用。通过右键单击图像按钮检查是否使用选项Inspect元素(仅在更高版本的浏览器中可用)并检查图像的源位置。
In ur case the image should be available on the same folder where the html is available.
在大多数情况下,图像应该在html可用的同一文件夹中可用。
Check for typo errors.
检查拼写错误。