473,386 Members | 1,705 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,386 software developers and data experts.

Multiple onload problem

On this page:
http://jimpix.co.uk/default-ajax1.asp

When viewed in IE6, only the wallppaper ajax section (which is 1 of 4 ajax sections, along with ecards / news / photo ecards and wallpapers), loads.

But in Firefox, they all load, when first loading the page.

I am using this method to load all of the functions on first loading the page:
http://www.netlobo.com/wom.html

My javascript functions are at the bottom of the page. Could the problem be to do with my first function - since this issue seems to be browser specific.

Thanks

Expand|Select|Wrap|Line Numbers
  1. function GetXmlHttpObject() {
  2.   var xmlhttp;
  3.   if (window.XMLHttpRequest) { // Mozilla, Safari, Opera...
  4.     xmlhttp = new XMLHttpRequest();
  5.     //if (xmlhttp.overrideMimeType) xmlhttp.overrideMimeType('text/xml');
  6.   } else if (window.ActiveXObject) { // IE
  7.       try {
  8.         xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  9.       } catch (e) {
  10.           try {
  11.             xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  12.           } catch (e) {}
  13.       }
  14.   }
  15.   if (!xmlhttp) {
  16.     alert('Cannot create an XMLHTTP instance');
  17.     return false;
  18.   }
  19.   return xmlhttp;
  20. }
  21.  
  22. var http = GetXmlHttpObject();
Mar 18 '08 #1
7 2037
acoder
16,027 Expert Mod 8TB
womAdd() requires strings. Put quotes around the function call.
Mar 20 '08 #2
Thanks for the reply. I have changed that, but for some reason, the page works fine in Firefox, when it first loads, but again, in IE6, it only displays the last of the 4 functions - the one in bold.

[HTML]<script type="text/javascript" src="_wom.js"></script>
<script type="text/javascript">
womAdd("sendRequest(MyCurrentVar + ',' + MyCurrentCat)");
womAdd("sendPhotoRequest(MyPhotoVar)");
womAdd("sendNewsRequest(MyNewsVar)");
womAdd("sendWPRequest(MyWPVar)");
womOn();
</script>[/HTML]

And if I comment out the bold line (calling the 'sendWPRequest' function), IE6 will display the 3rd function, but ignore the 1st and 2nd!

I uploaded the revised page again:
http://jimpix.co.uk/default-ajax1.asp

Thanks again

Jim
Mar 20 '08 #3
acoder
16,027 Expert Mod 8TB
It seems that IE6 is overwriting the onload. Try using this script and see if it makes a difference.
Mar 22 '08 #4
Thanks acoder, again, for your helpful suggestion and feedback.

I gave it a try, but would you believe it, just the same result:
http://jimpix.co.uk/default-ajax1a.asp

I think that's the 4th method I've tried now:

1. multiple list on the onload in the body tag:
[HTML]<body onload="sendRequest(MyCurrentVar + ',' + MyCurrentCat);sendPhotoRequest(MyPhotoVar);sendNew sRequest(MyNewsVar);sendWPRequest(MyWPVar);">[/HTML]

2. Use the window.onload:
Expand|Select|Wrap|Line Numbers
  1. window.onload = function()
  2. {
  3.     sendRequest(MyCurrentVar + ',' + MyCurrentCat)
  4.     sendPhotoRequest(MyPhotoVar)
  5.     sendNewsRequest(MyNewsVar)
  6.     sendWPRequest(MyWPVar)
  7. }
3. Use the NetLobo option:
http://www.netlobo.com/wom.html

4. Use Simon Wilson's option:
http://simon.incutio.com/code/js/addloadevent/

Do you think it just can't be done?

Thanks again for your help

Jim
Mar 22 '08 #5
acoder
16,027 Expert Mod 8TB
Then it must be that you're reusing the http-request object, so it doesn't finish one and starts another. Either use different variables for each one or wait for one to finish before making another request using the same variable.
Mar 22 '08 #6
Dear acoder,

you are a star! Thank you so much for your help. That was the problem all along. I created different variables for each function, and it works a treat now, in IE6 and Firefox. Thank you again, what a helpful person!

Jim
Mar 22 '08 #7
acoder
16,027 Expert Mod 8TB
You're welcome. Glad it's working now :)
Mar 23 '08 #8

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

Similar topics

0
by: Richard Payne | last post by:
I am developing a web application that utilises multiple grids, panels, validation controls etc on the same page. I have added the appropriate code to pop up dialogs to confirm delete in...
0
by: Richard Payne | last post by:
I am developing a web application that utilises multiple grids, panels, validation controls etc on the same page. I have added the appropriate code to pop up dialogs to confirm delete in...
2
by: Emmanuel | last post by:
Hi, I'm working on a c# web app and require having some code which runs in the page Load event of each page and to be reusable in other web apps. So i decided to use a Class Library which...
0
by: Richard Payne | last post by:
I am developing a web application that utilises multiple grids, panels, validation controls etc on the same page. I have added the appropriate code to pop up dialogs to confirm delete in...
4
by: Matt Ratliff | last post by:
Hello, I would appreciate any assistance you have with the following problem: I have (as an example) an array of values as follows: arrayvalues=new Array("0001","0003","0005") where each is the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
jinu1996
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...

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.