how to figer out the page is rendered by the browser

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Sep 2008
Posts: 1
Reputation: chandanmahajan is an unknown quantity at this point 
Solved Threads: 0
chandanmahajan chandanmahajan is offline Offline
Newbie Poster

how to figer out the page is rendered by the browser

 
0
  #1
Sep 5th, 2008
Hi,

I am working on the application in which Ajax, JSP, Javascript and html is used in UI part. We have our own UI frame work in which we update the page through AJAX. i.e. Initially page is loaded and later on we request to AJAX to update that particular page. But here page is updated without refreshing or reloading.

Requirement: Requirement is when the page is updated I have to make one button disable on that page.

Problem: I can make the button disable on 'onload' event of that page which get calls when the page is refreshed or reloaded. But as ajax update the page without refreshing/reloading the page, I am not able to get the event 'onload' and so I can not call the method which disable that particular button.

Is there any other way to work ? or

Is there any function of javascript which will be called automatically once the page is updated with refreshing?

Let me know if you need more information on this,

Thanks
Chandan
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 954
Reputation: essential will become famous soon enough essential will become famous soon enough 
Solved Threads: 131
Featured Poster
essential's Avatar
essential essential is offline Offline
Posting Shark

Re: how to figer out the page is rendered by the browser

 
0
  #2
Sep 5th, 2008
Am not sure if this wil solve the issue. But this may come in handy...

This will allow you to add function() calls once the page is loaded!
It's ideal for use in scripts that may be executing along side other scripts that have already been registered to execute once the page has loaded.


  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Some Title</title>

  1. <script type="text/javascript">
  2. <!-- BEGIN HIDING
  3.  
  4. function newLoadEvent( _function )
  5. { var _onload = window.onload;
  6. if ( typeof window.onload != 'function' )
  7. { window.onload = _function; } else { window.onload = function() {
  8. if ( _onload ) { _onload(); } _function();
  9. }
  10. }
  11. }
  12.  
  13. /* Name of some function()
  14.  to run on page load *///---->
  15. newLoadEvent( example );
  16. function example()
  17. { document.getElementById('sample').innerText = 'Hello World!';
  18. }
  19.  
  20.  
  21. /* More function() to run on page load *///----->
  22. newLoadEvent( function() { /* More code to run on page load */ alert('Hello World!');
  23. } );
  24.  
  25.  
  26. /* The 3rd function() to run on page load and so on... *///---->
  27. newLoadEvent( function() { document.getElementById('sample1').innerHTML = document.title;
  28. } );
  29.  
  30. // DONE HIDING -->
  31. </script>
  1. </head>
  2. <body>
  3. <p>
  4. <span id="sample"></span>
  5. <br />
  6. <span id="sample1"></span>
  7. </p>
  8. </body>
  9. </html>
Dev.Opera — FOLLOW THE STANDARDS, BREAK THE RULES...
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 381
Reputation: langsor is an unknown quantity at this point 
Solved Threads: 33
langsor langsor is offline Offline
Posting Whiz

Re: how to figer out the page is rendered by the browser

 
0
  #3
Sep 6th, 2008
Hi,

It's true that most elements do not support the onload event ... the window does and images do too.

I have yet to find a browser that loads content other than top to bottom, so you could effectively include a tiny-invisible-gif image at the very end of you dynamically loaded content and give it an onload event to call the javascript function that disables your button.

Hope this helps
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function loaded ( target ) {
  5. alert( target.parentNode.id );
  6. }
  7. </script>
  8. </head>
  9. <body>
  10. <div id="test">
  11. <img src="one.gif" onload="loaded(this)" />
  12. </div>
  13. </body>
  14. </html>
Google is the answer to all of your questions -- the trick is knowing what question to ask in your specific predicament.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC