Questions tagged [onload]

0

votes
0

answer
4

Views

Getting DOMException with playing video onload

I want to play a video when the website is loaded. For that I am using the following code: window.onload = function webisteLoaded() { var main_bg_video = document.getElementById('main_bg_video'); main_bg_video.play(); } Your browser does not support HTML5 video. Additional info: I import the s...
Filip Degenhart
1

votes
1

answer
26

Views

Best practice to check a script is loaded (and object exists in window space)?

This article helped explain how the browser is pulling in scripts, but what's the best practice to check an object exists before attempting to initialize it? In linking headroom.js here, I'm currently checking if the window object contains it. Is this okay, or should I be using some form of script.o...
sonikbotnik
1

votes
3

answer
7.3k

Views

JavaScript/HTML: How to use window.onload=x together with body onLoad=“setTimeout('myFunction()',4000);”

I'm using body onLoad='setTimeout('myFunction()',4000);' to refresh my website every 4 seconds. I want to use another JavaScript that will make my text fade. It works, but then my website won't refresh every 4 seconds. It's either fade or refresh. They interfere with each other. The text fading Scri...
Homie
1

votes
3

answer
356

Views

Why doesn't “onload” work on a <circle> element?

Code: This works perfectly well. 'setCoordinates(evt)' function gives the circle a random position when it is clicked on. However, when I replay 'onclick' with 'onload', it just stays at '500,500'. Why is this?
Maurice Tempelsman
1

votes
1

answer
40

Views

how to open a document when loading a web page [duplicate]

This question already has an answer here: Javascript Excel OpenFile 1 answer I want to open a excel document while loading a web page but i don't know how. I tried this: function myFunction() { window.open('file:///D://Files/doc.xlsx'); } But it didn't work. I want to mention that it has to be done...
Simona
1

votes
2

answer
22

Views

How to use local variable of Page_OnLoad method in OnClick event in asp.net C#

I am designing a website in which I need to update a table Company in my database through CompanyDetails page with respect to the auto increment field CompanyID which is being passed through Query string from previous page named Company and only one button is there for insert and update. So my probl...
Ritu Sharma
1

votes
3

answer
439

Views

Hide table if its <td> is empty (Using only JS)

I want to hide a table if its 'td' empty. I'm trying to use this function, but it's not working: function isEmptyTable(){ var tdTable = document.getElementsByName('tdTable').textContent; var table = document.getElementsByName('tableToday'); if(tdTable == '') table.style.display = 'none'; } Any tips?...
Luccas Freitas
1

votes
1

answer
94

Views

Ext JS: Event beforeload not not called in TreeStore

I defined a simple TreeStore like below: Ext.define('myApp.myStores.procoTreeStore', { extend: 'Ext.data.TreeStore', constructor: function (config) { var store = this; this.callParent(arguments); store.on({ scope: store, beforeload: this.foo }); }, foo: function () { colsole.log('foo called'); } //l...
Arno
1

votes
0

answer
88

Views

Iterating through : Reader.OnLoad

I think I'm quite close to resolving this for myself but I just can't get the last part working so was hoping for a little bit of help. I've spent the last couple of weeks trying to write this, using all sorts of resources from StackOverflow and although I've learned a fair bit in the process, I'm n...
Paul Wilson
1

votes
2

answer
41

Views

Duplicating base64 data

This is a follow up from the following link on stackoverflow Iterating through : Reader.OnLoad which Máté Safranka kindly helped me with earlier. I'm almost finished with it, does anyone know why in the function function onAllImagesLoaded(imageList) the line console.log ('imageList: ' + imageList)...
Paul Wilson
1

votes
2

answer
42

Views

Modal Shows but Won't Hide

I have the following modal on my master page as a loading message with a spinning gif whenever a page is loading. Please Wait... I'm using the following script to try to show and hide the modal. function showModal() { $('#divModal').modal('show'); } function hideModal() { $('#divModal').modal('hide'...
MugenDraco
1

votes
2

answer
34

Views

How to use when loading the page showing pop up

My concept is when service location is not matched while show the popup menu onloading of function buydisable() { alert('HOO'); return false; //not showed the alert $.post(jssitebaseUrl + '/ajaxAction.php', { 'action': 'buydisable' }, function(data) { alert(data); return false; $('#commonD...
Vincent
1

votes
0

answer
46

Views

Download a file BEFORE or DURING thank you page load

I wanted to create a thank you page that displays when someone starts downloading a file. The script I have works, but it only starts the download AFTER the page has finished loading which could take awhile. I have tried DOMContentLoaded but it doesn't work. Is there any other way I can start the do...
Jay Smoke
1

votes
0

answer
47

Views

jQuery scripts different order depending on first load or second refresh

I have a script that adds html code dynamically using jQuery (loops through a text file and loads images). After that, I apply dynamic CSS style and onclick events to the previously loaded images. When I load the page for the first time it works fine. But when I refresh (normal F5) the scripts execu...
Marc Samarra Deumal
1

votes
1

answer
50

Views

How to get a <a> element stored in localstorage

I'm storing an element in localstorage and trying to get it back in a function which runs on window.onload event. Problem is, after storing that element I get [object Object] and when I apply jquery on it, it throws exception. I'm trying to get its parent here. Could anybody help me My code:- $('a...
Samrat Matte
1

votes
0

answer
31

Views

Track load progress for custom loading bar via beforeunload

I'm trying to use nprogress with a PWA I've built to show a loading bar, particularly when the app is launched in standalone mode. My thought is to start the bar when beforeunload fires, and finish it just before the page actually unloads. To do this, I've set up the following: import NProgress from...
JacobTheDev
1

votes
0

answer
40

Views

Why does the code in Chrome console not execute after window.location.reload?

I'm using the Chrome console using the snippet tool. When I execute my code without the window.location.reload I can refresh the page manually and the code runs and selects the button I need it to. Is there any way to make it reload the page when I run the code, and subsequently run the function? wi...
Stephen James Mills
1

votes
1

answer
46

Views

How to use image onload in the loop?

I want to append new Image() in order. For example, netherlands_001.jpg, netherlands_002.jpg, netherlands_003.jpg, : : When I do not use Onload, the images are appended in order. But when I use Onload, the iamges are not appended in order. This below is concole log where you can see the image appen...
Tsubasa Yamaguchi
1

votes
0

answer
34

Views

How do I fix issues with using both javascript in an external file and javascript within html

I am building a TV application. it uses keypress navigation the application should display performance details as well because there won't be access to developer tools This is my code to get the performance details window.onload = function () { if ('timing' in window.performance) { document.getEleme...
user-6589801
1

votes
0

answer
27

Views

Undefined Response from Asynchronous Callback on GIPHY API

// //create the src for gif function loadGiphyData(tag, callback){ var data; var request = new XMLHttpRequest(); request.open('GET', `https://api.giphy.com/v1/gifs/search?q=${tag}&api_key=5p8A1b1szDSqAVgDP1m2dlq8z0rdO3h1&limit=10`, true); request.onload = function() { data = JSON.parse(request.respo...
Brian Lin
1

votes
1

answer
1.3k

Views

The GUID of the entity on a custom field

I want to create a custom textfield in a serviceactivity. When the serviceactivity onloads I would like to have the serviceactivities GUID in that textfield. Does anyone have any idea how I can solve this?
1

votes
2

answer
2.5k

Views

How to change an HTML elements style, and then revert it onLoad() with JS?

I have a problem with a Lightbox type modal window not working properly with IE. I have identified the problem as being due to the style attribute of the hidden image as 'display: none'. This works fine in all other browsers. But for IE, I need to change the value onload to 'display: block' and t...
igniteflow
1

votes
1

answer
766

Views

Show jQModal window on page load using ajax

I saw this question: Show jQModal window on page load and works fine when my content is not pulled from a remote source using ajax. How can I use ajax in jqmodal on page load ?
assembler
1

votes
2

answer
378

Views

removeChild <script> before JavaScript executes

I have a local file that I am displaying in an iframe. I cannot alter the file (or any files included- css, script, etc). I need to remove all of the tags from the file. This is easy enough, but I would like to remove them before the JavaScript inside them is executed. Simply doing: window.onload =...
Azmisov
1

votes
2

answer
2.1k

Views

onload don't load iframe jquery

On my page i have 2 iframes. I have a function to reload the iframe on click. Now I would like to load the main page without loading the 2 iframe. Is that possible? How would i do that? Discothèque Articles de presse Nouvelle recherche function discothequeReload () { var f = document.getElementById...
user472285
1

votes
2

answer
2.6k

Views

Ajax triggering body's onLoad event

My whole page is loading again whenever I make a ajax call to load a div. I have noticed that 'body onload=init()' onload event is getting triggered on ajax response and all the initialization is happening again. I don't want that to happen. Is there a way by which only div is loaded through ajax ca...
Mady
1

votes
1

answer
555

Views

Adding Javascript on Initial Load after updating UpdatePanels

On my Page_Load command for a page, I have a couple of tests that are performed before the screen is displayed with an alert box displaying if the user cannot access the screen. If Not Page.IsPostBack Then UpdatePanel1.ContentTemplateContainer.Controls.Add(ctl) UpdatePanel1.Update UpdatePanel2.Conte...
1

votes
1

answer
147

Views

How to use ajax results in a different part of the html page

I'm building a page which presents a list of branches of a store. The first branch is mandatory so its fields are hard coded in the page. If there are more branches in the DB for the user than the page will build the necessary rows when it's loading. So, if this is my current code: function initiali...
Ash
1

votes
1

answer
1.2k

Views

Onload event with iframe

I hope someone can help me - I'm at the point of giving up. I've got a page, if the page gets selected I want the pdf document to load in a frame. Originally the code had a button where if you clicked it it opened the pdf '', I tried to change that so that if the page loads it must open the pdf bu...
Wilest
1

votes
3

answer
455

Views

loading a single variable after document loads

I hope someone can help me here. I'm having trouble loading this variable. Right now I have an image that is being displayed when the document is ready. It has an id to it. So I'm trying to capture that id and alert it, but when I tried using .attr(), it gives me undefined variable. However, when I...
hellomello
1

votes
1

answer
2.1k

Views

Google setOnloadcallback() function clash with window.onload

here is my code: window.onload = function(){ google.load('visualization', '1', {packages:['corechart']}); google.setOnLoadCallback(function(){ alert('Message'); }); } I know it will work if I put google load outside window.onload. But I want it to be inside the window.onload. Any suggestions? Thanks
Vicheanak
1

votes
2

answer
969

Views

jquery function should hide / show box on page load depending on checked radio value

I have the following jsfiddle setup: http://jsfiddle.net/eyTBZ/2/ Basically almost everything works, apart from when the page is loaded and if the value audi is checked then the div engine should be hidden (or if the value is not audi the div should be displayed). Any help in getting this working wo...
Dino
1

votes
2

answer
871

Views

Load event delayed when using video and audio tags in html5

There is an audio and video component to the webpage I'm making. Additionally, I'm using google maps which has google.setOnLoadCallback which waits for the page to finish loading. My problem is that the google map is delayed showing up until the video and audio is loaded, which is kind of too long...
Alexis
1

votes
1

answer
1.8k

Views

Content Security Policy problems in calling functions and display images

Do not understand the the effect of the policy I specify at my site http://pcrypt.org/dev/groups.php. header('X-Content-Security-Policy: allow 'self'; img-src *; script-src 'self'; frame-src 'self'; style-src 'self';'); If I disallow inline scripts how do I then call a function. In the page I have t...
Beast
1

votes
1

answer
2.6k

Views

How can the onLoad event be used in a WordPress template?

When writing PHP templates for WordPress pages we shouldn't use the tag because it already exists in header.php which is called in the template. How than can we use the onLoad event within the template? Since I'm writing more than one template I can't use it in header.php.
teletoh
1

votes
1

answer
1.1k

Views

Check if iFrame starts to render or onload by Javascript

I know I cannot check the content in an iframe that contains 3rd party web page. All I want is simple, when I create an iframe, I want to get a callback when the page triger onload, or starts to render, or domready, or other events which I can know the URL is working (is not a dead link) Anyidea whi...
Eric Yin
1

votes
1

answer
1.1k

Views

Run function after Jcrop has finished loading (solution)

This is not a question, just a tip after trying to get this to work myself. Maybe people know about it already but I found no documentation of it (on the Jcrop site or elsewhere). This is actually just an undocumented feature, looking at the source code for Jcrop I noticed that it accepted a functio...
Jan
1

votes
2

answer
2.8k

Views

adding an object or a function to a html dom element (specifically canvas)

I am trying to add my own object parameter to a canvas element as in jquery (like it adds element_id.draggable, element_id.resizable etc to the dom elements). My piece of code looks like this: window.addEventListener('DOMContentLoaded',handler,false); function handler() { HTMLCanvasElement.prototype...
gopi1410
1

votes
1

answer
557

Views

Setting viewScope onLoad and onResize

I have used the '@media only screen' in my CSS to determine how and what information should be shown depending on the users screen size. I have a class called panelContainer which is set to display when the screen is greater than 767px, and a class called mobileContainer which displays when the scre...
Fiona Sheridan
1

votes
1

answer
1.1k

Views

Javascript image onload callback class-intern function

Objekt.prototype.loadImg = function(pImg){ if(pImg!=null){ this.imgLoaded=false; this.img = null; this.img = new Image(); this.img.src = pImg; this.img.onload = function(){ alert('!'); this.autoSize(); this.imgLoaded=true; }; } } My Problem is that 'this' is invalid in...
user1511417

View additional questions