[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Why won't the onmouseover command work?

Posted on 2010-08-18
9
Medium Priority
?
235 Views
Last Modified: 2013-11-19
When the user scrolls over the text boxes, it should display a message from the indirectly embedded javascript page.  Is there an error in this code somewhere, because when I scroll over the text boxes, nothing happens.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<!--dynValueContactForm.html
	Uses dynValueContactForm.js
	Illustrates dynamic values
	-->
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <title> Contact Form </title>
      <link rel = "stylesheet" type = "text/css" href = "team3styles.css" />
      <script type = "text/javascript" src = "dynValueContactForm.js" >
      </script>

   </head>
   <body>
      <h3> Customer Information </h3>
      <form action = "">
        <p>
           <label>Name (last name, first name, middle initial)
	   	   <input type = "text" onmouseover = "messages(0)"
	  		onmouseout = "messages(2)" />
	  	   </label> <br />
		   <label class = "required"> (required) </label>
	       <br /> <br />

	       <label>Email Address (yourname@wherever.com)
	       <input type = "text" onmouseover = "messages(1)"
	  		onmouseout = "messages(2)" />
	  		</label> <br />
	       <label class = "required"> (required) </label>
	       <br /> <br />
	<label> Your message: </label> <br />
		<textarea name = "custMessage" rows = "6" cols = "60">
		</textarea>
	  	<br /><br />
	<textarea id = "adviceBox"  rows = "3" cols = "50">This box provides advice on filling out the form on this page.  Put the mouse cursor over any input field to get advice.
   	</textarea>
   	   </p>
   	<p class = "regText">
   	 	Go ahead...
   	<a style = "color: blue;"
   		onmouseover="this.style.color = 'red';
   					 this.style.font = 'italic 16pt Times';"
   		onmouseout="this.style.color = 'blue';
   					this.style.font = 'normal 16pt Times';">
   		try it!
	</a><br /><br /><br />

	       <input type = "reset" id = "reset" />

	       <input type = "submit" id = "submit" /><br /><br />

	<br /><a href = "Team_3_Home_Page.html"> Return to Home </a>
   	</p>
   	</form>
    </body>
</html>

Open in new window

0
Comment
Question by:mkelly2384
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2
9 Comments
 

Author Comment

by:mkelly2384
ID: 33471528
Here is the .js file that goes with it...
// dynValueContactForm.js
// Illustrates dynamic values

var helpers = ["Your name must be in the form: \n \
 first name, middle initial., last name",
  "Your email address must have the form: \
  user@domain",
  "This box provides advice on filling out\
  the form on this page. Put the mouse cursor over any \ 
  input field to get advice"]

// *********************************************************** 
// The event handler function to change the value of the 
// textarea
  
function messages(adviceNumber) {
 	document.getElementById("adviceBox").value = helpers[adviceNumber];
}

Open in new window

0
 
LVL 2

Expert Comment

by:ajisasaggi
ID: 33471827
The escape characters at the end of the messages are causing the problem (not sure why though).
You can either remove them or replace with the string concatenation operator.
0
 
LVL 10

Expert Comment

by:Jini Jose
ID: 33471830
the problem i found is the messages array is not declared.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 10

Accepted Solution

by:
Jini Jose earned 668 total points
ID: 33471849
when i changed the variable value to one single line var helpers = ["Your name must be in the form: \n \ first name, middle initial., last name",  "Your email address must have the form: \  user@domain",  "This box provides advice on filling out\  the form on this page. Put the mouse cursor over any \   input field to get advice"]

and put a semicolum at the end.

it is working perfectly.

0
 
LVL 9

Assisted Solution

by:Snarfles
Snarfles earned 664 total points
ID: 33471860
Try this

var helpers = ["Your name must be in the form: \n first name, middle initial., last name",
  "Your email address must have the form: user@domain",
  "This box provides advice on filling out the form on this page. Put the mouse cursor over any input field to get advice"];

see http://snarfles.net/code/mouseover.html to see it working.

Cheers

Luke
0
 
LVL 2

Assisted Solution

by:ajisasaggi
ajisasaggi earned 668 total points
ID: 33471886
Found the problem.
There is an extra blank space after the escape character at line 9 in the JS file. Just remove that.

By the way, there is an easy way to validate JS files in Windows. Just double click the file and error messages, if any, will be displayed.
0
 
LVL 10

Expert Comment

by:Jini Jose
ID: 33471899
if you are using firefox, then it is easy to find the javascript errors. just click the tools--> error console. it will display the page errors.

0
 
LVL 16

Expert Comment

by:Easwaran Paramasivam
ID: 33472002
Please do ensure the path specified of dynValueContactForm.js in <script type = "text/javascript" src = "dynValueContactForm.js" > is correct and the file existance.
0
 

Author Closing Comment

by:mkelly2384
ID: 33502336
Thanks everybody.  It's working great!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question