html - 单击时输入按钮上的图像消失

标签 html css

我有一个带有图像的按钮,按下该按钮可链接到另一个页面。一切正常,除非我单击按钮时它会消失,并且在选择页面上的其他内容之前图像不会重新出现。 HTML 如下:

<input type="submit" class="personalbutton" value="" onclick="location.href='http://www.google.ca'">

personalbutton CSS 类:

.personalbutton {
background-image: url(../images/buttons/buttonimage.png);
width: 175px;
height: 50px;

如何防止这种情况发生?

最佳答案

不要使用“提交”类型的标签来创建您的按钮,而是尝试使用该标签,看看您是否仍然遇到同样的问题。

<button class="personalbutton" onclick="location.href='http://www.google.ca'">Click Me</button>

关于html - 单击时输入按钮上的图像消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8176294/

相关文章:

javascript - CSS:我怎样才能有一个 "scatter display of words"而不是 html 默认显示向上/向下?

javascript - video.js 无法在 IE 9,10 或 11 中加载/工作

用于在图像旁边居中垂直文本的 HTML + CSS

html - 为什么无法更改脚本产生的字符串的颜色?

html - 在 IE8 中修复元素的 z-index

html - 按钮内的图像在 Firefox 中未正确定位

css - 背景 : url ("/static/img/fauxColumns1.png") repeat-y ( -10px? )

jquery - 在一个页面上集成 Bootstrap 元素

javascript - 如何在 JavaScript 中验证输入?

html - 我的网站在 FireFox 和 Google Chrome 中看起来一样,但在 IE 中不一样