2011-07-29 25 views
2

我在我的网站周围使用jQuery UI,想知道如何使用上传按钮的样式而不是标准的灰色uploadify按钮。如何将我自己的样式应用于uploadify灰度渐变按钮?

的JavaScript:

<script type="text/javascript"> 
$(document).ready(function() { 
     $("button").button(); 
     $("input:button").button(); 
     $("#file_upload").button(); 

    $('#file_upload').uploadify({ 
    'uploader' : 'files/uploadify.swf', 
    'script' : 'files/uploadify.php', 
    'cancelImg' : 'files/cancel.png', 
    'folder' : 'uploads/', 
    'auto'  : false, 
    'multi'  : true, 
    'buttonText' : 'Choose Pictures', 
    'onAllComplete' : function(event,data) { 
     alert(data.filesUploaded + ' files uploaded successfully!'); 
    }, 
    'hideButton' : true 
    }); 
}); 
</script> 

HTML:

<form id="upload_images" name="form1" action=""> 
<input type="file" id="file_upload" name="file_upload" /> 
<a href="javascript:$('#file_upload').uploadifyUpload();">Upload Files</a> 
</form> 

这可能吗?我尝试使用buttonimg选项,但是这看起来没有很好的结果,因为我看不到“按钮”上的任何文本。正如你可以看到下面我也试图隐藏按钮选项,但这只是隐藏灰色按钮。有任何想法吗?

+0

您可能只需要硬着头皮只是创建与它的文本图像;那将是最简单的解决方案。 – rkw

回答

0

下载uploadify包后,似乎灰色按钮是使用Adobe Flash实现的。如果您尝试检查Firebug中的按钮,您会看到它是一个嵌入式Flash对象。

对不起,请不要以为您的问题有任何解决方法。

3

我改变了Uploadify的灰色按钮样式。我刚才说的东西如下:

'buttonImg': 'images/create_album.png', 
'width': '273', 
'height': '51', 
'wmode': 'transparent', 

全码:

$(document).ready(function() { 
     $("#<%=FileUpload1.ClientID%>").uploadify({ 
      'uploader': 'scripts/uploadify.swf', 
      'script': 'Upload.ashx', 
      'cancelImg': 'images/cancel.png', 
      'buttonImg': 'images/create_album.png', 
      'width': '273', 
      'height': '51', 
      'wmode': 'transparent', 
      'folder': 'uploads', 
      'multi': true, 
      'auto': true, 
      'onAllComplete': function (event, queueID, fileObj, response, data) {      
      } 
     }); 

    });  
相关问题