SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: Simply JavaScript
-
Jul 31, 2007, 00:46 #1
- Join Date
- Jul 2007
- Posts
- 2
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Simply JavaScript
Thank you for your help. I'm working through the SitePoint book Simply JavaScript but am stuck on pages 68-69. My code does not work. I just get object required before the alert? I could post the code if I knew how but if you have access to the book or the free download pages you may be able to see what I mean.
Regards
Steve
-
Aug 1, 2007, 00:34 #2
- Join Date
- Apr 2000
- Location
- Melbourne, Australia
- Posts
- 2,571
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Steve,
As explained in Chapter 7, an "object required" error means that you're attempting to access a property or method on a variable that contains a null value, rather than a valid object.
In this case, the line that it's failing on is this alert:Code:alert(target.nodeName);
Chances are you've linked to the script from the top of your HTML file, and you have failed to use the script structure shown on p.59 to make sure that your code is only executed after the document has fully loaded.Kevin Yank
CTO, sitepoint.com
I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
Baby’s got back—a hard back, that is: The Ultimate CSS Reference
-
Aug 1, 2007, 02:20 #3
- Join Date
- Jul 2007
- Posts
- 2
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Kevin
Thanks for your reply - it works now I've placed the code below as you explained
I'm sure I will make progress now. Your book is ideal for the course I've just taken - I will suggest it as recommended reading.
Regards
Steve
Bookmarks