webmanz Posted March 19, 2018 Report Share Posted March 19, 2018 (edited) Re Event Handlers part 2 from Chapter 2 The only consol error I couldn't replicate as per the video was the hover. In the video the consol log error appears as: Something happened: 2nd p tag moused-over Instead I get on Sublime text Firefox: SyntaxError: identifier starts immediately after numeric literal My code looks like this: <!DOCTYPE html> <html onkeypress="sniffer('You pressed a key!')"> <head> <meta charset="UTF-8"> <title> Ch2 Javscript</title> <script> function sniffer(message) { console.log("Something happened: "+ message); } </script> <style type="text/css"> #secondP {width: 200px; background-color: #AFE6A5} p:hover, button:hover {cursor: pointer;} </style> </head> <body onresize="sniffer('window resized')" onload="alert('page loading')"> <h1>Welcome Uber Nerdling!</h1> <button id="butt" type="button" onlcick="sniffer('Try it button clicked')">Try it</button> <p onclick="sniffer('p tage clicked')">&Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quaerat neque quo inventore ipsam, eveniet obcaecati et possimus, quas sed dolores autem delectus expedita! Quis amet alias accusantium at debitis, tempora.</p> <p onmouseover="sniffer(2nd p tag moused-over')" id="secondP">&Lorem ipsum dolor sit amet, consectetur adipisicing elit. Possimus quod, voluptate dolor adipisci officia consequatur blanditiis nobis voluptatibus magni ipsum. Perspiciatis, autem? Suscipit quasi nam odio blanditiis, harum voluptate quidem.</p> Edited March 19, 2018 by webmanz Quote Link to comment Share on other sites More sharing options...
administrator Posted March 19, 2018 Report Share Posted March 19, 2018 Have you tried comparing the source file with your code? Stef Quote Link to comment Share on other sites More sharing options...
administrator Posted March 19, 2018 Report Share Posted March 19, 2018 3 hours ago, webmanz said: <p onmouseover="sniffer(2nd p tag moused-over')" id="secondP">&Lorem ipsum dolor sit amet, consectetur adipisicing elit. Possimus quod, voluptate dolor adipisci officia consequatur blanditiis nobis voluptatibus magni ipsum. Perspiciatis, autem? Suscipit quasi nam odio blanditiis, harum voluptate quidem.</p> .... Just glancing over your code, did you notice the missing single quote? onmouseover="sniffer(2nd p tag moused-over')" .. should be: onmouseover="sniffer('2nd p tag moused-over')" Quote Link to comment Share on other sites More sharing options...
webmanz Posted March 22, 2018 Author Report Share Posted March 22, 2018 On 3/19/2018 at 6:22 PM, administrator said: .... Just glancing over your code, did you notice the missing single quote? onmouseover="sniffer(2nd p tag moused-over')" .. should be: onmouseover="sniffer('2nd p tag moused-over')" That solved it Stef thanks Quote Link to comment Share on other sites More sharing options...
administrator Posted March 22, 2018 Report Share Posted March 22, 2018 Welcome Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.