使用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")');

07-24 09:50
查看更多