$(function() {
var script = document.createElement('script');
script.id="filepicker";
script.type="text/javascript";
script.src="//api.filepicker.io/v1/filepicker.js";
var body=document.querySelectorAll("body")[0]; ;
body.appendChild(script);
var ButtonsArea = document.querySelectorAll('.frm-buttons')[0];
var textArea = document.getElementById('text_editor_textarea');
var button = document.createElement('span');
var divText=document.createTextNode("Upload File");
button.id="newDoc";
button.setAttribute("onclick","getPick()");
button.appendChild(divText);
ButtonsArea.appendChild(button);
function getPick(){
filepicker.setKey('AWpNcAmH9TmiWtEgHsFwBz');
filepicker.pick({
mimetypes: ['text/*'],
services:['COMPUTER'],
maxSize:50*1024
},function(FPFile) {
var docFile = FPFile.url;
textArea.value=textArea.value+'[url]'+FPFile.url+'+'+FPFile.filename+'[/url]';
});
}
});
有人说我的 getPick() 函数没有定义是不是所有的 JavaScript 都缺少一些东西,也许 JavaScript 时间已经关闭,因为一切都是动态创建的?