简体   繁体   中英

How can I hook up my own button to the downloadify lib

Does anyone know how can I hook up my own button to the downloadify lib Instead of using

<div id="downloadify"></div>

I want to have this assigned to some other button or element. So I can avoid using the custom button it has.

The the demo in the lib page is this one:

<script type="text/javascript">
  Downloadify.create('downloadify',{
    filename: function(){
      return document.getElementById('filename').value;
    },
    data: function(){ 
      return document.getElementById('data').value;
    },
    onComplete: function(){ 
      alert('Your File Has Been Saved!'); 
    },
    onCancel: function(){ 
      alert('You have cancelled the saving of this file.');
    },
    onError: function(){ 
      alert('You must put something in the File Contents or there will be nothing to save!'); 
    },
    transparent: false,
    swf: 'media/downloadify.swf',
    downloadImage: 'images/download.png',
    width: 100,
    height: 30,
    transparent: true,
    append: false
  });
</script>

And can be found here: http://pixelgraphics.us/downloadify/test.html

Thanks in advance

您可以指定任何ID。

Downloadify.create( id_or_DOM_element, options );

最佳解决方案是“ setlio”所说的内容您将按钮图像设置为透明图像,并将所需的文本或图片放在其下方

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM