Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > BOOK: Beginning JavaScript and CSS Development with jQuery
|
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 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
 
Old May 30th, 2011, 06:07 AM
Authorized User
 
Join Date: Sep 2008
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?
 
Old May 30th, 2011, 07:16 AM
Authorized User
 
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
 
Old May 31st, 2011, 02:18 AM
Authorized User
 
Join Date: Sep 2008
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?





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 08: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 09:11 AM
a:hover problems Stevie CSS Cascading Style Sheets 4 May 8th, 2005 04:30 PM





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