onload

Checking for multiple images loaded

本秂侑毒 提交于 2020-01-13 08:18:12
问题 I'm using the canvas feature of html5. I've got some images to draw on the canvas and I need to check that they have all loaded before I can use them. I have declared them inside an array, I need a way of checking if they have all loaded at the same time but I am not sure how to do this. Here is my code: var color = new Array(); color[0] = new Image(); color[0].src = "green.png"; color[1] = new Image(); color[1].src = "blue.png"; Currently to check if the images have loaded, I would have to

initialize angular on window.onload event

杀马特。学长 韩版系。学妹 提交于 2020-01-11 12:26:25
问题 In a thirth party framework, A html page can be modified by providing javascript code that will be added by the framework to the window onload. From their content can be written to the AddIn div element. How could I inject a angular application into this div element (HTML + js). <!DOCTYPE html> <html> <head> <script src="http://apps.bdimg.com/libs/angular.js/1.4.0-beta.4/angular.min.js"></script> <script src="http://code.jquery.com/jquery-2.1.4.min.js"></script> <link rel="stylesheet" href=

alternative to javascript load for an object of type image/svg-xml

橙三吉。 提交于 2020-01-07 01:49:05
问题 my load function in chrome is giving me different values for the height and width of the image on the first load. it gives correct values only once i reload the same image. is there an alternative to checking if an image has loaded? i call it to check if the svg image is loaded. 1) i create an object in js of type image/svg-xml 2) onload { get the height and width } ISSUE HERE 3) do something with these 2 values because the first load is wrong the 3) step also generates incorrect output (for

Page On load event in JSF

ⅰ亾dé卋堺 提交于 2020-01-06 08:13:47
问题 I am trying to assign values to my dropdown during page load. I followed the way which is given in this link. Invoke JSF managed bean action on page load As per the link, i have tried using both the annotation and constructor type. but its an exception for me, SEVERE: An exception occurred javax.faces.FacesException: java.lang.reflect.InvocationTargetException Caused by: java.lang.reflect.InvocationTargetException Caused by: javax.el.ELException: Detected cyclic reference to managedBean

Page On load event in JSF

∥☆過路亽.° 提交于 2020-01-06 08:12:13
问题 I am trying to assign values to my dropdown during page load. I followed the way which is given in this link. Invoke JSF managed bean action on page load As per the link, i have tried using both the annotation and constructor type. but its an exception for me, SEVERE: An exception occurred javax.faces.FacesException: java.lang.reflect.InvocationTargetException Caused by: java.lang.reflect.InvocationTargetException Caused by: javax.el.ELException: Detected cyclic reference to managedBean

How to run a function when CSS stylesheet finishes loading

别等时光非礼了梦想. 提交于 2020-01-06 05:43:04
问题 How do I run a function when a stylesheet finishes loading? Here is my code.. var d = document, css = d.head.appendChild(d.createElement('link')) css.rel = 'stylesheet'; css.type = 'text/css'; css.href = "https://unpkg.com/tachyons@4.10.0/css/tachyons.css" 回答1: According to MDN's <link>: The External Resource Link element, You can determine when a style sheet has been loaded by watching for a load event to fire on it; similarly, you can detect if an error has occurred while processing a style

disable iframes automatic onload

社会主义新天地 提交于 2020-01-05 13:51:10
问题 i have one html with multiple pages in it. i have some pages that i open them in iframes. when i open the html page (it contains all pages in it) it starts loading all iframes and the page becomes so laggy and slowly. is there any way to disable automatic iframes load? or is there any other way to open pages without iframes but still stay in my app? this is my part of my pages (that in one html) code: <html> <head> </head> <body> <div data-role="page" id="website"> <div data-theme="a" data

Using window.onload in AngularJS service

邮差的信 提交于 2020-01-05 03:59:06
问题 I'm using AngularJS 1.6 to create a game that relies on some images. The game is separate from Angular for the most part, and instantiated by a service, before any of the controllers are run. I want the game to be instantiated by a service so that I can expose it to other controllers, which do interact with the game in some capacity. I use $window.onload, but it only works when the page first loads. When I refresh the page, the event doesn't fire, presumably because the browser is getting the

Javascript window.onload not working in iOS captive portal/network

你离开我真会死。 提交于 2020-01-04 09:19:06
问题 I've got this bit of code in the header of a jsp file. For some reason, it runs fine on desktop and mobile browsers, but on the iOS captive portal, only the first alert is triggered. Does anyone know why? <script type="text/javascript"> alert("first alert"); window.onload = function() { alert("second alert"); }; </script> 回答1: I figured it out. Using this works... <script type="text/javascript"> alert("first alert"); window.addEventListener('load', function() { alert("second alert"); }, false

Capturing onload event when dynamically loading .js files?

佐手、 提交于 2020-01-04 08:40:39
问题 Is there a capture the on load event when dynamically adding a script tag with JavaScript in IE? The code below works in FireFox and Chrome but not in IE. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title></title> </head> <body> </body> </html> <script type="text/javascript" language="javascript"> var elemScript = document.createElement("script");