onload

Jquery UI interface looks ugly before document.ready

我的梦境 提交于 2019-12-12 10:29:33
问题 HTML elements show earlier then onload or document.ready is fired. All jQuery UI widgets load on document.ready and it makes page look ugly for few first seconds. Possible option to deal with it - hide elements before they are pimped out with jQuery UI and show them with JS after load. But in case JS is turned off - user will not see any elements neither standard HTML nor jQuery UI. What is the best practice to work with it? 回答1: If you look at the jQuery UI documentation, let's take tabs for

Javascript dynamic script loading via functions… how to do onload or readyState all over again?

爷,独闯天下 提交于 2019-12-12 03:59:48
问题 At present, I have a javascript callable functions (without adding global variables) that add scripts to the head. Onload is useful for pages after the site loaded initially, but I'm waiting to load larger scripts until they're needed considering many won't need them. The following code works for some scripts, but not for some larger ones... function include(script) { var head= document.getElementsByTagName('head')[0]; var newScript= document.createElement('script'); newScript.type= 'text

How to wait for HTML document to load/render before printing it (plain JavaScript)

≡放荡痞女 提交于 2019-12-12 03:35:15
问题 I am using this code to open and print image on new html page: printView(dataUri:string){ var win = window.open(); win.document.write( '<img src="' + dataUri + '">'); win.print(); win.close(); } When used like that and image is larger than few kB, print preview opens a blank page, because document is not rendered when print is invoked. I solved that (temporarily) by introducing setTimeout with ~200ms delay before printing, like this: setTimeout( () => { win.print(); win.close(); }, 200); And

How can I execute something after a new window has finished loading?

那年仲夏 提交于 2019-12-12 03:27:29
问题 I need to close a new window after it fully loads. I have: my_window=window.open("http://www.yahoo.com", "_blank", "resizable=yes, scrollbars=yes, titlebar=yes, width=500, height=400, top=10, left=10"); I've tried: my_window.onload = my_window.close(); and my_window.addEventListener('load', my_window.close(), true); Neither wait for my_window to finish loading before closing (it closes pretty much immediately). Secondary question, can I add a timeout to go ahead and close the new window in

Displaying the Popup box generated by Greybox on page load(onLoad)

拈花ヽ惹草 提交于 2019-12-12 03:17:15
问题 I have the following html code : <a href="http://google.com/" title="Google" rel="gb_page_center[500, 500]">Launch</a> It launches a popup generated with GREYBOX when I click on LAUNCH. but now I want this to happen automatically every time the website is opened! How do I do that? 回答1: <body> <script> AJS.AEV(window, 'load', function() { GB_show("Hello world", "http://google.com"); }); </script> The AJS library used by greybox offers it's own pageload call 来源: https://stackoverflow.com

Cross-browser onload event in a static script tag

雨燕双飞 提交于 2019-12-12 03:05:45
问题 Is there a cross-browser way to associate an onload event to a static script tag, in a html document? The following will not work in IE 7 and IE 8: <script onload="DoThat" type="text/javascript" src="..."></script> Some background I have found a way to accomplish this with a dynamic script tag and if statements. It is for example explained in this MSDN article. My issue is that I need to locate the current script tag, because I am building widgets that insert DOM elements in-place. In the

onload event in <img> tags firing prematurely in Firefox, not other browsers

荒凉一梦 提交于 2019-12-12 00:53:13
问题 The onload event in inline HTML is firing prematurely in Firefox and all browsers based on its Mozilla codebase (Tor, etc.) For example: <img onload="myFunction()" src="image.jpg" /> This calls myFunction() after the image is fully loaded on Chrome, Opera, IE, and Safari (not sure about the new Edge browser, though), which is the expected and documented behavior. However, on Firefox and its relatives, the function is called immediately upon the browser reading the <img> tag, i.e. before the

JSF page onload executes button click

自闭症网瘾萝莉.ら 提交于 2019-12-11 23:13:34
问题 I have a following JSF page and I check if user is logged in on body onload event. <h:body onload="#{adminManagedBean.adminIsLoggedIn()}"> <div id="top-bar" class="pure-g"> <div class="pure-u-1-2"> <img src="images/logo.png" border="0" style="margin-left: 20px;"/> </div> <div class="pure-u-1-2"> <div class="pure-menu pure-menu-open pure-menu-horizontal"> <ul> <li><a href="addProduct.xhtml">Add product</a></li> <li><a href="products.xhtml">Products</a></li> <li><a href="orders.xhtml">Orders</a

write labels for <option> tags based on selectedIndex using JavaScript

感情迁移 提交于 2019-12-11 18:17:46
问题 This next question works in conjunction with the question I posted at loading text into textarea based on drop down selection That has been solved and I have templates posting to text boxes based on drop down selection using: var showLeftTemplates = function(sel) { var locations = [ "template 1", "template 2", "template 3", "template 4", "template 5", ]; var srcLocation = locations[sel.selectedIndex]; if (srcLocation != undefined && srcLocation != "") { document.getElementById('LeftTemplates'

Different behavior of web app in different IE8 versions

有些话、适合烂在心里 提交于 2019-12-11 17:47:51
问题 I am facing a strange issue of different behavior of a same web application in different IE8 versions.One version is like IE 8 CO ( corporate administrator ) i.e version A and another is normal IE 8 version. i.e version B The issue is in version A, I am calling one cgi on the onload event which is responsible to flash a file on a board. But in vA it is not getting called at all which I can figure out from the logs of apache web server and also from internal logging methods. In case of vB, it