Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: JavaScript 24-Hour Trainer
This is the forum to discuss the Wrox book JavaScript 24-Hour Trainer Jeremy McPeak; ISBN: 978-0-470-64783-7
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: JavaScript 24-Hour Trainer section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 19th, 2013, 10:45 AM
Registered User
Points: 31, Level: 1
Points: 31, Level: 1 Points: 31, Level: 1 Points: 31, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2011
Posts: 7
Thanks: 3
Thanked 0 Times in 0 Posts
Default Lesson 21 - tagName & className

Having trouble with tagName & className because it is null and not an object per IE9 and not a function per Firebug on Firefox.

the Javascript code I have which I used for lesson are as follows:

Code:
function mouseHandler(event)
        {
            var eSrc = event.target;
            var type = event.type;

            if (eSrc.tagName.ToUpperCase() === "SPAN")
            {
                if (type === "mouseover")
                {
                    if (eSrc.className !== "button-click") 
                    {
                        eSrc.className = "button-over";
                    }
                }
                else if (type === "mouseout")
                {
                    if (eSrc.className !== "button-click") 
                    {
                        eSrc.className = "button-normal";
                    }
                }
                else if (type === "click")
                {
                    if (eSrc.className !== "button-click")
                    {
                        eSrc.className = "button-click";
                    }
                    else
                    {
                        eSrc.className = "button-over";
                    }

                }
            }
        }

        eventUtility.addEvent(document, "mouseover", mouseHandler);
        eventUtility.addEvent(document, "mouseout", mouseHandler);
        eventUtility.addEvent(document, "click", mouseHandler);
Appreciate your help Thanks!
  #2 (permalink)  
Old June 21st, 2013, 11:38 AM
jmcpeak's Avatar
Wrox Author
Points: 467, Level: 7
Points: 467, Level: 7 Points: 467, Level: 7 Points: 467, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2005
Location: , Texas, USA.
Posts: 87
Thanks: 0
Thanked 18 Times in 17 Posts
Default

Howdy mrubin78,

The code you provided uses ToUpperCase() instead of toUpperCase(). That should solve the problem for Firefox. As for IE9, make sure the browser is in IE9 standards mode.
The Following User Says Thank You to jmcpeak For This Useful Post:
mrubin78 (July 8th, 2013)


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lesson 21 Try It (Handling Errors) Mech_1000 BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer 3 February 21st, 2013 10:49 AM
Lesson 21 Confused econophil BOOK: JavaScript 24-Hour Trainer 1 January 7th, 2013 11:42 AM
Errors LESSON CS 28 & 29 FINAL MRGLENN BOOK: PHP and MySQL 24-Hour Trainer 2 December 7th, 2012 09:06 PM
Lesson 21 Try It Cristina BOOK: Java Programming 24-Hour Trainer by Yakov Fain 0 March 28th, 2012 02:58 AM
Chapters 20 & 21 as a starting point Lawrence Lovig BOOK: Beginning Unix ISBN: 0-7645-7994-0 2 October 9th, 2006 11:51 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.