如何使用javascript从url下载文件? [英] how to download a file from a url with javascript?
本文介绍了如何使用javascript从url下载文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正试图从用户输入一个网址的文本框中获取以下内容:
new Ext.form.TextField({
disabled:false,
fieldLabel:file,
值:'',
id:url};
我需要值这个变量是包含在上面url中的文件,我正在尝试如下:
var file1 = new OpenLayers.WPS.ComplexPut ({
identifier:file1,
value:window.location.href = document.getElementById(url)
感谢您的答案
解决方案
您可以使用jQuery从URL中加载任何内容很简单:
< script>
$(#loadhere)load(http: /www.google.com);
< / script>
how to download a file from a url with javascript?
I'm trying to get from a textfield a user enters a url as follows:
new Ext.form.TextField({
disabled: false,
fieldLabel: "file",
value:'',
id:"url"};
and I need the value of this variable is the file contained in the above url I am trying as follows:
var file1 = new OpenLayers.WPS.ComplexPut({
identifier: "file1",
value: window.location.href = document.getElementById("url")
Thanks for your answers
解决方案
You can use jQuery to load anything from an URL quite easily with:
<script>
$("#loadhere").load("http://www.google.com");
</script>
这篇关于如何使用javascript从url下载文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文