Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

undefined error

Posted on 2012-03-23
5
Medium Priority
?
181 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:Gurvinder Pal Singh
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:
Gurvinder Pal Singh earned 2000 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…

877 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