473,394 Members | 1,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Is there any event which calls a javascript function as soon as the page/form loads ?

3
I have a function written in js. I need to call this as soon aspage is finished loading. Now i am displacing this on mousehover event. I dont want to call this event, i want to see this change as soon as page is finished loading. Onload() doesnt work for me. i am using ie8.


Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4. <head>
  5. <style>
  6. #blank_bar{
  7.      width: 100px;
  8.      height: 15px;
  9.      background:grey;
  10. }
  11.  
  12. #filled_bar{
  13.      height: 15px;
  14.      background:green;
  15. }</style>
  16.  
  17. <script>
  18.     function load()
  19.     {
  20.         var elem = document.getElementById('filled_bar');
  21.         elem.style.width=$countDetails + "%";
  22.     }
  23. </script>
  24.  
  25. <p><b>Estimate Completion:&nbsp $countDetails% complete</b></p>
  26.  
  27. <div id="blank_bar"><div id="filled_bar" onmouseover="load()"></div></div>
  28.  
  29.  
  30. </div>
  31. </body>
  32. </html>
  33.  
$countDetails is a computed value.
Mar 14 '14 #1
3 1304
Luuk
1,047 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. <body onload="load()">
According to some info*) the function is executed after loading the 'body'
*) 1 oreilly
2 stackoverflow
Mar 14 '14 #2
jaya26
3
This doesnot work in IE but works in other browser. i tried this is IE8 but it doesnt work.
Mar 17 '14 #3
Luuk
1,047 Expert 1GB
"it does not work" ==> makes me laugh.... ;-(

If next code works in IE6, i would not know why it should not work in IE8*
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script>
  4. function load() {
  5.    alert('test');
  6.   var elem = document.getElementById('test');
  7.   elem.innerHTML="test";
  8. }
  9. </script>
  10. </head>
  11. <body onload="load()">
  12. <div id="test"></div>
  13. </body>
  14. </html>
*sorry, i don't have a machine with IE8 here....
Mar 22 '14 #4

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

Similar topics

4
by: cjl | last post by:
Hey all: I am preloading a large number of images for my web application, and I want to display something indicating progress. So I am simply swapping the visibility of an animated gif (which...
1
by: Jason Huang | last post by:
Hi, What I want to do here is in the asp.net C#, when I click a button then some sorts of validation will be checked, then it will call a javascript function to open another webform. Would...
1
by: prince -=nore=- | last post by:
I'm trying to open a new window when a button is clicked. I'm using the following code in my page_load to do so. Dim myScript As String = "<script language=javascript> function loadWin()...
2
by: gomzi | last post by:
hi, I would like to know as to how one could call a javascript function on page load. I would not like to call it through onload attribute that one can specify in the body because i am passing...
1
by: wesly | last post by:
How to call a button_ click event from javascript function i need syntax for call a button click event from javascript.
10
by: patelxxx | last post by:
Problem: I am trying to input my name in a text box and I click on transfer and I want the name to appear on the same page (i.e. in another form). How is this done? <BODY> <HTML> <form...
1
by: santhoskumara | last post by:
I am using Internet Explorer browser, I want to know how to clear cache and cookies using javascript function or java, when each time the page is loaded. i know to do manually in IE using TOOLS...
0
by: Chetana | last post by:
Hi, How to call any javascript function from button_click function.It means first executes the inside logic of button _click() function and then calls javascript function. Thanks, Chetana
5
by: =?Utf-8?B?TWF0Y29u?= | last post by:
Hello, I have a asp.net 2.0 (vb.net) page, which uses a master page, and there is a javascript function (myfunction) defined in the <headof that master page. Is there a way to run the function...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.