473,466 Members | 1,565 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Object Expected Error

renji1981
8 New Member
Hi Pals

Im getting Object Expected Error and Im new to Ajax . I have pasted the Html code here .. please help .

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head> 
  3. <title>My first ajax Application </title>
  4. <script language="javascript">
  5. var XMLHttpRequestObject =false;
  6. if(window.XMLHttpRequest)
  7. {
  8. XMLHttpRequestObject = new XMLHttpRequest();
  9. }
  10. else if(window.ActiveXObject)
  11. {
  12. XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
  13. }
  14. funtion getdata(datasource , divid)
  15. {
  16. if (XMLHttpRequestObject)
  17. {
  18. var obj = document.getElementById(divid);
  19. XMLHttpRequestObject.open("GET",datasource);
  20. XMLHttpRequestObject.onreadystatechange = funcion()
  21. {
  22. if (XMLHttpRequestObject.readystate ==4 && XMLHttpRequestObject.status ==200)
  23. {
  24. obj.innerHTML = XMLHttpRequestObject.responseText;
  25. }
  26. XMLHttpRequestObject.send(null);
  27. }
  28. }
  29. </script>
  30. </head>
  31. <body>
  32. <form>
  33. <input type ="button" value="Click here " onclick="getdata('data.txt','target')">
  34. </form>
  35. <div id = "target">
  36. Hi this is just a test
  37. </div>
  38. </html>
  39.  
the data file is in the same folder as the html file is and just contains some basic text
do reply to[edit]
Jan 18 '09 #1
5 1139
Dormilich
8,658 Recognized Expert Moderator Expert
there are some typos creating havoc:
line #4 better use the type attribute
line #14 the keyword is "function"
line #20 (same as line #14)
Jan 18 '09 #2
renji1981
8 New Member
@Dormilich

thanks for the reply ...there is no error now . but it is not loading the file contents which i have in the Data.txt file .My first ajax Application ... can you please check it
Jan 18 '09 #3
Dormilich
8,658 Recognized Expert Moderator Expert
it's a typo again:
line #22: XMLHttpRequestObject.readyState

note: unbeatable for debugging: Firebug plugin for Firefox
Jan 18 '09 #4
renji1981
8 New Member
Thanks a lot ... Works Perfect Now .... Really appreciate the Quick response from this site .. i waited 2 days in another site and dint get get even 1 replies . Thanks to the Moderators
Jan 18 '09 #5
Dormilich
8,658 Recognized Expert Moderator Expert
I'm pleased about such a praise, nevertheless we're here to help (Experts, Members (and Moderators))
Jan 18 '09 #6

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

Similar topics

4
by: Bill | last post by:
I call a function in my .js file like this: onClick="location.href='blank.html' + generateSearchStringFromForm('section')" where section is the name of my form. The function is defined as...
2
by: jsnX | last post by:
i want a function object that is a) initialized with an STL container foo b) will search foo for an object of type foo::value_type here is my code: ...
2
by: FredC | last post by:
OS Name Microsoft Windows XP Professional Version 5.1.2600 Service Pack 2 Build 2600 Total Physical Memory 1,024.00 MB MDE 2003 Version 7.1.3008 ..NET Framework 1.1 Version 1.1.4322 SP1...
11
by: westplastic | last post by:
This one is driving me insane. The script works perfect on Firefox, but Internet Explorer keeps complaining about "Error Object Expected" and stuff like that. I've run it through Firefox's Java...
26
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized...
12
by: Andrew Poulos | last post by:
With the following code I can't understand why this.num keeps incrementing each time I create a new instance of Foo. For each instance I'm expecting this.num to alert as 1 but keeps incrementing. ...
4
by: loserdude84 | last post by:
Hi I keep getting the good old error 'Object Expected Error' on a site I recently built. I am really struggling with this one. Object Expected Error Line 66 <div...
1
by: JOJO123 | last post by:
I got here in search of an answer to this Javascrpt question. I upgraded jave on XP Ie 7, acrobat 5.1 and suddenly can't open any pdf files on web sites using IE. I see u guys all say, this is a...
10
RMWChaos
by: RMWChaos | last post by:
WinVista/IE7 I am getting some weird errors only in IE7, but not in FF2.0.0.8 or NN9. It even happens on this website when I click "Sign In". The error is: "A Runtime Error has occurred."...
2
by: thj | last post by:
Hi. I've got this form that I'm trying to validate: <form id="periodForm" action="" method="post"> <p> Periode: <input id="startDate" name="startDate" type="text" size="7" value="<%=...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
1
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
isladogs
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.