473,832 Members | 2,132 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trigger a function after the page is fully loaded

258 Contributor
[MOD: Moved from the PHP forum. --pbmods]

Hi everyone
Actually I'm not sure if I have to post this question in PHP forum.
I have a page (download page) which contains a link but I want the link to be invisible until the page is fully loaded.
The reason is that if the link apears at the begining then the user will click on it to download the file and then close the window before banners are loaded and it would not be counted as a page view on google adsense.
So I need to have an invisible link which apears when the page is fully loaded.
I'v seen this before on other websites but don't know how to do it. I think I'm gonna need a JAVA function or something.

Any suggestions will be appreciated

Oct 13 '08 #1
5 3127
583 Contributor
What about something like <body onload="myfunct ion()"> ? And give your function some kind of action to show the link?

Oct 14 '08 #2
258 Contributor
Thanks joedeene
You solved my problem. I wasn't sure if ONLOAD runs the function when the HTML is loaded or after loading the whole page.
It seems to work fine now.
Here is what I used:

Expand|Select|Wrap|Line Numbers
  1. <body onload="objectid.style.display='block'">
  2. <a id="objectid" href="www.example.com" style="display:none">something</a>
  3. </body>
Thanks again
Oct 14 '08 #3
16,027 Recognized Expert Moderator MVP
That won't work in most browsers, at least in strict mode.

Use document.getEle mentById() to access an element. The ID doesn't make it accessible in the global namespace.
Oct 14 '08 #4
258 Contributor
That won't work in most browsers, at least in strict mode.

Use document.getEle mentById() to access an element. The ID doesn't make it accessible in the global namespace.
Thanks for the help acoder
I really appreciate it :)
Oct 14 '08 #5
16,027 Recognized Expert Moderator MVP
No problem, you're welcome :)
Oct 14 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

by: TomB | last post by:
I have a function on an "included" page. For reasons unknown to me I frequently will get an error - to the effect that the function can't be found. If I hit refresh/F5 it loads the page just fine. It doesn't happen often .. maybe once every 50 pages. It also doesn't happen on any specific page.
by: Jehan | last post by:
At the end of my HTML page I have following..... <script> for (i = 0; i < document.section_entry.length;i++) { // some code } </script>
by: foldface | last post by:
Hi Given a web page using frames, is there anyway the left frame can request a page in the right frame and, most importantly, detect when it has fully loaded? Ideally this requires no changes to the original web page being loaded on the right. Something like document.frame2.fullyLoaded? You get the idea Thanks F
by: coolsti | last post by:
I am aware of the setInterval and setTimeout functions for Javascript, but I can't seem to find an example that lets me do what I need to. I have a script that needs to wait until a certain condition is met. In this case, the condition is that an iframe has been reloaded completely. I do this by examining a hidden document variable in the iframe, and when it has changed from "" to "1" is the signal for me that the iframe is loaded. (if...
by: rmorvay | last post by:
I allow users to click a datagrid row and it spawns another browser page to allow edits to the data in that row. Once they update the data, it is committed to the database and the form is closed. Once the edit page is closed, I need to trigger the search button click event in order to refresh the datagrid with the original search criteria. I cannot figure out how to trigger the Button1_ServerClick event of the main page from the called...
by: zglazer | last post by:
Hi -- I'm working on a website that uses Javascript and CSS to show or hide portions of text on each page. There's a sort of table of contents at the top of each page, and rather than using anchor links, my client wanted the selected item from the table of contents to trigger both the showing of its corresponding text, and the hiding of the text corresponding to the other items in the table of contents. I wrote the following code to...
by: Cleverbum | last post by:
I'm hoping to execute some code "when the page has completely finished loading" by which I mean the page and all the images on it, does anyone know of a way to do this?
by: aljamala | last post by:
Hi, I have a link for an employee directory search page. The link (http:// xxxx/Search.aspx) works fine, however, I have another link to do an Advanced Find. and its href is javascript:SEC38536A_OSA()
by: Mike McIntyre | last post by:
What event can be used to call a JavaScript function when the page loads AND when it receives a response from the web server? Thanks, -- Mike Mike McIntyre http://www.getdotnetcode.com
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.