大约有 34,600 项符合查询结果(耗时:0.0378秒) [XML]

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

Resizing an image in an HTML5 canvas

... like these! so anyway, here is a 'fixed' version of your example: img.onload = function() { var canvas = document.createElement("canvas"); new thumbnailer(canvas, img, 188, 3); //this produces lanczos3 // but feel free to raise it up to 8. Your client will appreciate // that the...
https://stackoverflow.com/ques... 

When to use setAttribute vs .attribute= in JavaScript?

... in JavaScript. It should handle the different types of attributes (think "onload") correctly. Use getAttribute/setAttribute when you wish to deal with the DOM as it is (e.g. literal text only). Different browsers confuse the two. See Quirks modes: attribute (in)compatibility. ...
https://stackoverflow.com/ques... 

How can I handle time zones in my webapp?

...p 1. Use the Geolocation of the user using the Geolocation API window.onload = getMyLocation; function getMyLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(displayLocation); } else { alert("Oops, no geolocation supp...
https://stackoverflow.com/ques... 

TypeScript with KnockoutJS

...val(() => this.utcTime(new Date().toUTCString()), 500); } } window.onload = () => { // get a ref to the ko global var w: any; w = window; var myKO: any; myKO = w.ko; var el = document.getElementById('content'); myKO.applyBindings(new GreeterViewModel(myKO), el...
https://stackoverflow.com/ques... 

What are the differences between Deferred, Promise and Future in JavaScript?

... has signature like: function (path, callback, context) and listens to onload && onreadystatechange */ $(function () { getScript('path/to/CodeMirror', getJSMode); // onreadystate is not reliable for callback args. function getJSMode() { getScript('path/to/CodeMirror/mode...
https://stackoverflow.com/ques... 

Using HTML5/Canvas/JavaScript to take in-browser screenshots

... const result = await new Promise((resolve, reject) => { video.onloadedmetadata = () => { video.play() video.pause() // from: https://github.com/kasprownik/electron-screencapture/blob/master/index.js const canvas = document.createElemen...
https://stackoverflow.com/ques... 

CSS filter: make color image with transparency white

...tContext("2d"); var img = new Image; //wait for the image to load img.onload = function() { //Draw the original image so that you can fetch the colour data ctx.drawImage(img,0,0); var imgData = ctx.getImageData(0, 0, canvas.width, canvas.height); /* imgData.data i...
https://stackoverflow.com/ques... 

How do I pass variables and data from PHP to JavaScript?

... } var oReq = new XMLHttpRequest(); // New request object oReq.onload = function() { // This is where you handle what to do with the response. // The actual data is found on this.responseText alert(this.responseText); // Will alert: 42 }; oReq.open("get", ...
https://stackoverflow.com/ques... 

AngularJS : Initialize service with asynchronous data

...HR, which you can customize. var oReq = new XMLHttpRequest(); oReq.onload = xhrCallback; oReq.open("get", "/api/overview", true); // your specific API URL oReq.send(); }) Now, your NavData constant exists. Go ahead and inject it into a controller or service: angular.module('MyApp...
https://stackoverflow.com/ques... 

Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the La

...usly, so it doesn't lag // the web application var a = new FileReader(); a.onload = function(e) { // Capture result here console.log(e.target.result); }; a.readAsDataURL(blob); Allowing user to save data Apart from obvious solution - opening new window with your dataURL as URL you can d...