473,396 Members | 2,059 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,396 software developers and data experts.

getting error in IE6

Hello all,

I am using javascript and ajax.
i had writen the following javascript code. which runs fine with firefox but it is not work in Internet Explorer 6.0 tell me whats the problem.

the java script code is as below
Expand|Select|Wrap|Line Numbers
  1. function checkfortasks(url,id)
  2.         {
  3.              var httpRequest;
  4.             if (window.XMLHttpRequest) 
  5.             { 
  6.                 // Mozilla, Safari, ...
  7.                 httpRequest = new XMLHttpRequest();
  8.                 if (httpRequest.overrideMimeType) 
  9.                 {
  10.                     httpRequest.overrideMimeType('text/xml');
  11.                 }
  12.             } 
  13.             else if (window.ActiveXObject) 
  14.             { // IE
  15.                 try 
  16.                 {
  17.                     httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
  18.                 } 
  19.                 catch (e) 
  20.                 {
  21.                     try 
  22.                     {
  23.                         httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
  24.                     } 
  25.                     catch (e) {}
  26.                 }
  27.             }
  28.             if (!httpRequest) 
  29.             {
  30.                 alert('Giving up :( Cannot create an XMLHTTP instance');
  31.                 return false;
  32.             }
  33.             httpRequest.onreadystatechange = function() 
  34.             {
  35.                 if (httpRequest.readyState == 4) 
  36.                 {
  37.                     try
  38.                     {
  39.                     document.getElementById(id).innerHTML=(httpRequest.responseText);
  40.                     }
  41.                     catch(ex)
  42.                     { //alert(ex.message);
  43.                     }
  44.                 }
  45.             }
  46.             httpRequest.open('GET',url, true);
  47.             httpRequest.send(null);
  48.  
  49.             theObject = document.getElementById(id);
  50.             theObject.style.visibility = "visible";
  51.             theObject.style.height="8px";
  52.             theObject.style.width="200px";
  53.             var posx = 0;
  54.             var posy = 0;
  55.             theObject.style.left = posx + "px"; 
  56.             theObject.style.top = posy + "px"; 
  57.         }
  58.  
and the html code from where i am calling the js function is as below.

Expand|Select|Wrap|Line Numbers
  1.   <td>
  2.     <img src="image/flakes.jpg" onClick="checkfortasks('flakes.php','fill');" title="Click here To add Flakes" onMouseOver="hover(this);" onMouseOut="hout(this);"/>
  3.   </td>
  4.  
please tell me where i had done mistake!!
Thanks.
Oct 16 '07 #1
8 1597
acoder
16,027 Expert Mod 8TB
What error message are you getting and on what line?
Oct 16 '07 #2
What error message are you getting and on what line?
Hi,

I am getting error: Object Expected
at from where the function called i mean from html.
thanks for reply.
Oct 16 '07 #3
acoder
16,027 Expert Mod 8TB
Can you show the code for the element with id "fill"?

Have you checked that it isn't the mouse events?

I suggest you move the
Expand|Select|Wrap|Line Numbers
  1. var httpRequest
on line 3 to outside the function to make it global.
Oct 16 '07 #4
Hi,

This is my html code, i had also used div instead of span but facing the same problem. Error: Object Expected. also tried withe global httpRequest variable.

Expand|Select|Wrap|Line Numbers
  1. <body>
  2.     <form name="Show" action="" method="post">
  3.         <table> 
  4.             <tr> 
  5.                 <td>
  6.                     <img src="image/flakes.jpg" onClick="javascript: checkfortasks('flakes.php','fill');" title="Click here To add Flakes" onMouseOver="hover(this);" onMouseOut="hout(this);"/>
  7.                 </td>
  8.               </tr>
  9.             <tr>
  10.                 <td>
  11.                     <span id="fill">
  12.                     </span>
  13.                 </td>
  14.             </tr>
  15.         </table>            
  16.  
  17.   <div id='con1' style="position: relative;"></div>
  18.  
  19.   <div id='con2' style="position: relative;"></div> 
  20.             <script language="javascript">
  21.                 var acon1=document.getElementById("con1");
  22.                 Drag.init(con1,null,0,600,0,600);
  23.                 var acon2 = document.getElementById("con2");
  24.                 Drag.init(acon2, null,0,600,0,600);
  25.             </script>    
  26.     </form>
  27. </body>
  28.  
Thanks for spending time for me.
Oct 17 '07 #5
acoder
16,027 Expert Mod 8TB
So does the error occur when you click on the image?
Oct 17 '07 #6
So does the error occur when you click on the image?
Yes dear i am facing the error while click on image.
the same code running in mozila firefox without facing any type of error but dont know how it get error in IE.
so please......
Oct 18 '07 #7
Thanks for your help,,

Now i have got the solution for it.
i just remove the form and table, tr, td tag from the main page that i had posted before. now it works fine for me in mozila firefox and IE6.


Mayur.
Oct 18 '07 #8
acoder
16,027 Expert Mod 8TB
Now i have got the solution for it.
i just remove the form and table, tr, td tag from the main page that i had posted before. now it works fine for me in mozila firefox and IE6.
Interesting. Well, good to see that you got it working.
Oct 18 '07 #9

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

Similar topics

15
by: sara | last post by:
Hi I'm pretty new to Access here (using Access 2000), and appreciate the help and instruction. I gave myself 2.5 hours to research online and help and try to get this one, and I am not getting...
8
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
32
by: paul | last post by:
HI! I keep on getting this error and I have tried different things but I am not sure how to send the expiring date. The error that I am getting in Firefox 1.5 is "Error: expires.toGMTString is...
2
by: MSK | last post by:
Hi, Continued to my earlier post regaring "Breakpoints are not getting hit" , I have comeup with more input this time.. Kindly give me some idea. I am a newbie to .NET, recently I installed...
4
by: imaloner | last post by:
I am posting two threads because I have two different problems, but both have the same background information. Common Background Information: I am trying to rebuild code for a working,...
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: 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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
agi2029
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,...

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.