onload

Java FX application onload event

∥☆過路亽.° 提交于 2019-12-06 13:22:28
I am implementing an application in java swing java fx with Google maps API. My problem is this, I need when the map is loaded runs a javascript. I've be reading of the method: webEngine.getLoadWorker().StateProperty().AddListener but does not work in my code. I wonder if anyone has any idea how to do this. I leave my code: SwingHtmlDemo.Java: public class SwingHtmlDemo { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { ApplicationFrame mainFrame = new ApplicationFrame(); mainFrame.setVisible(true); } }); } } /* Main window used

EJS access express variable in JS onload function

帅比萌擦擦* 提交于 2019-12-06 06:59:50
问题 I know you can get the value of variables in an ejs file like so, <h1><%= title %></h1> if i were to use the same title variable in a onload javascript function in the same ejs page, how would i use it . for instance <script> window.onload(){ var s = <%= title %> alert(s); } </script> this function produces a console error saying Uncaught syntax error: Unexpected identifier although I'm able to see the actual value of the variable 回答1: To output it within a script, the result will need to be

How to dynamically resize iFrame in Firefox?

霸气de小男生 提交于 2019-12-06 06:33:48
I used the solution stated on this page to resize the iFrame depending on the content: Resizing an iframe based on content And it works perfectly, except in Firefox. In Firefox, the other content is cut-off but once you keep on refreshing the page, the browser will slowly reveal the rest of the content. I saw someone replied that this is the solution to the problem: Use jQuery to get the body height in framed.html (FF issue, body kept growing): var height = $(document.body).height(); However, I don't know where to put that line of code. Do I insert it somewhere within the 3 snippets of scripts

Animated GIF while loading page does not animate

旧街凉风 提交于 2019-12-06 04:12:57
问题 I have a page which is being generated serverside using asp.net (C#). It takes a while for the page to load as it has up to 100 iframes. I want to show a "please wait" animated gif while the page is loading, so I have the following: <style type="text/css"> #blackout { filter:alpha(opacity=70); -moz-opacity:0.7; opacity:0.7; position:absolute; background-color:#222233; z-index:50; left:0px; top:0px; right:0px; bottom:0px; width:102%; height:102%; } #loading { filter:alpha(opacity=100); -moz

this.name returns undefined in javascript

馋奶兔 提交于 2019-12-06 02:06:38
问题 I am trying to remotely create an onclick for each div (to save typing time). Here is the window.onload function; window.onload = function() { divel = document.getElementsByTagName('div'); for(var el in divel){ divel[el].onmouseover = function(){ this.style.textDecoration = "underline"; }; divel[el].onmouseout = function(){ this.style.textDecoration = "none"; }; divel[el].onclick = function(){ document.getElementById('game').src = "/games/" + this.name; }; } } The name of every div is

addLoadEvent is not helping with onload conflict

血红的双手。 提交于 2019-12-06 01:07:13
I'm using the popular addLoadEvent as follows for all my JS loading: function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } } addLoadEvent( locationToggle ); addLoadEvent( step1 ); addLoadEvent( step2 ); addLoadEvent( step3 ); addLoadEvent( getCounties ); addLoadEvent( mapSelection); Everything I've read suggests this is a fairly bullet proof way of avoiding onload conflicts. And yet this method doesn't appear to working any better than

Caching problem with asynchronous javascript loading with onload event

半世苍凉 提交于 2019-12-05 22:43:43
I am currently trying to load some js files asynchronously, so that they are not able to block the rest of the website. I mainly followed the descriptions found here: Asynchronous Javascript In terms of the non blocking loading of the javascript file this works great, but i got now the problem that the javascript file is cached and stays cached even if i change the content (also doing shift-reload does not help anything). My current code of loading the script looks like the following: (function() { function xx_async_load() { var xx = document.createElement('script'); xx.type = 'text/javascript

What would be a walkaround for JavaScript alerts that are generated in a page's onload() using Selenium?

老子叫甜甜 提交于 2019-12-05 21:49:44
I am automating a form page using Selenium RC (C#). After I click 'Submit' button, I get an alert ' Records Edited Successfully! '. The title of this alert box is ' The page at http://www .******.com says: '. But Selenium doesn't see this alert. And I can't work around it. Here is what I've tried: selenium.Click("ctl00_Content_ctl00_btnSubmit"); selenium.WaitForPageToLoad("30000"); Result: I get the following error: " Selenium.SeleniumException : Timed out after 30000ms " Then I tried: selenium.Click("ctl00_Content_ctl00_btnSubmit"); selenium.OpenWindow("", "The page at The page at http://www.

jQuery function triggered on window resize but not on page load

僤鯓⒐⒋嵵緔 提交于 2019-12-05 21:36:27
I found this jQuery code that allows to center a div that doesn't have fixed dimensions both horizontally and vertically. It works with the window height and width. So when I resize the window, the div is still centered within the window. My issue is that, right now, it doesn't work unless I resize the window first. So if I just load the page, the div isn't centered unless I manually resize the window. This, of course, is not ideal. So I'm trying to find a way around it. But my jQuery skills being very limited I'm stuck right now. Here's the page I'm working on: http://dev.manifold.ws/test2/

script的加载方式与执行

别等时光非礼了梦想. 提交于 2019-12-05 19:57:04
script一般是阻塞式加载的,H5新增了 async 、 defer 和 module 特性,可用于异步加载/延迟执行: async 属性是指当这个 script 可用时,就异步执行它 defer 属性是指当页面被解析完毕后,才能执行 如果以上两个属性都没有,则立刻下载并执行,同时阻止页面的解析,直到执行完毕 module 属性是指关联脚本全部下载后才会执行,且不受defer影响 标准定义详见: https://html.spec.whatwg.org/#the-script-element 关于async和defer aysnc 的 script 不能保证在 jQuery(document).ready 的时候是可用的,而 defer 可以。 这篇博文 给出了如下测试结果: jQuery(document).ready 的执行时序。 Chrome 下是:defer -> jQuery(document).ready -> async -> window.onload。 Firefox 下是:async -> defer -> jQuery(document).ready -> window.onload。 我又把 JavaScript 的下载速度变慢,发现结果仍然没有变化。 所以使用async的时候需要谨慎,全局的属性和方法最好提前定义。 动态加载javascript基本