Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > BOOK: Beginning JavaScript and CSS Development with jQuery
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning JavaScript and CSS Development with jQuery
This is the forum to discuss the Wrox book Beginning JavaScript and CSS Development with jQuery by Richard York; ISBN: 9780470227794
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning JavaScript and CSS Development with jQuery section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old May 30th, 2011, 07:07 AM
Authorized User
Points: 350, Level: 6
Points: 350, Level: 6 Points: 350, Level: 6 Points: 350, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2008
Location: , , Pakistan.
Posts: 54
Thanks: 8
Thanked 1 Time in 1 Post
Default 'Exception' is not counting the no. of times the mouse hover on the text.

<html>
Whenever I hover mouse on the text, it should get counted which is not happening (below is the code):

<head>
<title>Event handling</title>
</head>
<body>

<h1> Event <h1>


/* <p> <a onmouseover = "alert('Pop up window text')"> Text of the webpage </a></p></h1></h1> this line of code was properly runnning whenever I hovered mouse on it, but it was not counting the no. of times I did. So for that I code the line below*/

<p> <a href="http://www.google.com" onmouseover='++count; alert ("Moved")'> jjj</a></p>

</body>
</html>

'Exception' is not counting the no. of times the mouse hover on the text.


Please do guide me. Thanks in advance.
__________________
How to do programming?
Reply With Quote
  #2 (permalink)  
Old May 30th, 2011, 08:16 AM
Authorized User
Points: 448, Level: 7
Points: 448, Level: 7 Points: 448, Level: 7 Points: 448, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2011
Posts: 86
Thanks: 1
Thanked 12 Times in 12 Posts
Default

Hi arbab,

are you following the book? Which chapter are you add?

Just looking at your code (pleain javascript, no jquery), it looks like your missing the declaration of the global variable "count".

To have your code work (with plain javascript) you have to add the following to your head section:
Code:
<script language="javascript">
	var count = 0;
</script>
Hope this helps
Reply With Quote
  #3 (permalink)  
Old May 31st, 2011, 03:18 AM
Authorized User
Points: 350, Level: 6
Points: 350, Level: 6 Points: 350, Level: 6 Points: 350, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2008
Location: , , Pakistan.
Posts: 54
Thanks: 8
Thanked 1 Time in 1 Post
Default Mouse over did not worked

I tried this code, it did not even picked the mouse over and I want it to count mouse overs but yes hyperlink did worked.

<html>
<head>
<title>Event handling</title>
<script language="javascript">
var count = 0;
</script>
</head>
<body>

<h1> Event <h1>


<p> <a href="http://www.google.com" onmouseover='++count; alert ("Moved")'> jjj</a></p>

</body>
</html>
__________________
How to do programming?
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 5 code modification. Counting the number of times a certain string occurs. scolty BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3 3 April 28th, 2011 09:29 AM
a:hover AlexW CSS Cascading Style Sheets 4 February 27th, 2011 10:03 AM
Hover/Text Decoration Weirdness interrupt CSS Cascading Style Sheets 2 August 8th, 2005 10:11 AM
a:hover problems Stevie CSS Cascading Style Sheets 4 May 8th, 2005 05:30 PM



All times are GMT -4. The time now is 10:32 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.