大约有 47,000 项符合查询结果(耗时:0.0166秒) [XML]

https://stackoverflow.com/ques... 

Get image data url in JavaScript?

...= new Image(); img.setAttribute('crossOrigin', 'anonymous'); img.onload = function () { var canvas = document.createElement("canvas"); canvas.width =this.width; canvas.height =this.height; var ctx = canvas.getContext("2d"); ctx.drawImage(this, 0, 0)...
https://stackoverflow.com/ques... 

How to open a local disk file with JavaScript?

...; if (!file) { return; } var reader = new FileReader(); reader.onload = function(e) { var contents = e.target.result; displayContents(contents); }; reader.readAsText(file); } function displayContents(contents) { var element = document.getElementById('file-content'); elem...
https://stackoverflow.com/ques... 

Including a .js file within a .js file [duplicate]

...ocument.getElementsByTagName("head")[0].appendChild(x); You may also use onload event to each script you attach, but please test it out, I am not so sure it works cross-browser or not. x.onload=callback_function; share ...
https://stackoverflow.com/ques... 

Resizing an iframe based on content

...ent. To do this, framed.html has an iframe with src='' specified. When its onload fires, it evaluates its own height, and sets the src of the iframe at this point to helper.html?height=N There's an explanation here of how facebook handle it, which may be slightly clearer than mine above! Code In...
https://stackoverflow.com/ques... 

How to detect idle time in JavaScript elegantly?

...a JavaScript: var inactivityTime = function () { var time; window.onload = resetTimer; // DOM Events document.onmousemove = resetTimer; document.onkeypress = resetTimer; function logout() { alert("You are now logged out.") //location.href = 'logout.html' ...
https://stackoverflow.com/ques... 

Checking if jquery is loaded using Javascript

...ame $() syntax. Remove your $(document).ready() (use something like window.onload instead): window.onload = function() { if (window.jQuery) { // jQuery is loaded alert("Yeah!"); } else { // jQuery is not loaded alert("Doesn't Work"); } } ...
https://stackoverflow.com/ques... 

How do I convert an existing callback API to promises?

...load() { return new Promise(function(resolve, reject) { window.onload = resolve; }); } You would then use the resulting promise like so: load().then(function() { // Do things after onload }); With libraries that support deferred (Let's use $q for this example here, but we'll...
https://stackoverflow.com/ques... 

How to change the opacity (alpha, transparency) of an element in a canvas element after it has been

...ctx.restore(); If you need img to be loaded: var img = new Image(); img.onload = function() { ctx.save(); ctx.globalAlpha = 0.4; ctx.drawImage(img, x, y); ctx.restore() }; img.src = "http://..."; Notes: Set the 'src' last, to guarantee that your onload handler is called on all...
https://stackoverflow.com/ques... 

Load and execution sequence of a web page?

...RL. When the parsing is ended and document is ready and loaded, the events onload is fired. Thus when onload is fired, the $("#img").attr("src","kkk.png"); is run. So: Document is ready, onload is fired. Javascript execution hits $("#img").attr("src", "kkk.png"); kkk.png is downloaded and loads int...
https://stackoverflow.com/ques... 

How to parse Excel (XLS) file in Javascript/HTML5

...rseExcel = function(file) { var reader = new FileReader(); reader.onload = function(e) { var data = e.target.result; var workbook = XLSX.read(data, { type: 'binary' }); workbook.SheetNames.forEach(function(sheetName) { // Here is your object ...