Solved

undefined error

Posted on 2012-03-23
5
174 Views
Last Modified: 2012-03-27
i get an error in internet explorer only pointing hello in undefined. how do i resolve it. what am i missing?

<script type="text/javascript">hello.spend();</script>
0
Comment
Question by:jcbmtt
  • 2
  • 2
5 Comments
 
LVL 40

Expert Comment

by:gurvinder372
ID: 37756060
hello is not defined yet..that is why you get 'undefined error'
0
 
LVL 7

Expert Comment

by:Lalit Chandra
ID: 37756085
hello is undefined means that browser is not able to find that hello..
To Understand,change your code with the following line for demonstration only


<script type="text/javascript">

var hello = {
    spend =function() {
          alert("This is the sample only");
     }
}


hello.spend();

</script>

Hope this will fix up your problem.
0
 

Author Comment

by:jcbmtt
ID: 37756143
chandra

is ur function harmless? i dont want the function to do anything. its just to beat the undefined error.
0
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
ID: 37756215
it is quite harmless, you can make it more harmless by doing it

var hello = {
    spend =function() {}
};
0
 

Author Closing Comment

by:jcbmtt
ID: 37770042
thanks
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question