我使用 JavaScript+jQuery 来处理图像宽度:
JavaScript
var imageWidth = .9 * $(window).innerWidth();
var imageHeight = .6 * $(window).innerWidth();
$("document").ready(function(){
$(".class").css("width",imageWidth);
$(".class").css("height",imageHeight);
});
但我也用它来为我的提交按钮提供一个 PHP 健壮的图像
CSS
form input[type=submit]{
background: url("xyz.png") no-repeat center center;
width: 90px;
height: 60px;
border: none;
color: transparent;
font-size:0;
}
(有关此 CSS 技术的更多信息,请访问 www.suburban-glory.com/blog?page=140)
我的问题不是很难,但是我找不到我需要的信息。如何在 JavaScript 中调用表单输入 [type=submit]
以便我可以操作用于提交按钮的图像? (正如您在示例中看到的,我只是简单地调用了 CSS 类)
最佳答案
$('form input[type="submit"]').css('background-image', 'url("xyz.png")');
关于javascript - 在 css3 表单上使用 Javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13242700/