Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: checking for blank texboxes using onblur


Message #1 by "Rowena Perks" <Rowenap@w...> on Tue, 5 Dec 2000 12:59:57 -0000
you can write a generic function if you pass the object reference using the
'this' keyword. sample code follows:

<body>
<input type=text id="t1" onBlur="CheckMe(this)">
<input type=text id="t2" onBlur="CheckMe(this)">
</body>
<script>
	function CheckMe(object)
	{
		alert("you have just left the text box with the id of " +
object.id + ". The text entered was " + object.value)
	}
	
</script>

-----Original Message-----
From: Rowena Perks [mailto:Rowenap@w...]
Sent: Tuesday, December 05, 2000 7:00 AM
To: javascript
Subject: [javascript] checking for blank texboxes using onblur


-----Original Message-----
From: barry.j.pattison [mailto:barry.j.pattison@E...]
Sent: 04 December 2000 13:57
To: feedback@w...
Subject: 


good morning:
	i have just started reading one of your professional javascript 
books and have a question.  i am more than wet behind the ears about js 
but have programming knowledge in other areas including html so i am 
not a complete fool.  
	i am writing a very rudimentary first page with first name and 
last name text boxes.  i would like to use a function to check to see 
if the text is left blank.  i am using onblur and it is working for the 
first name.  but, i would like to use the same function for both first 
name and last name.  i realize ther may be many ways of doing this, 
however, giving me the simplest way would be a time-saver for you and 
me.  i would like the fields to call the function separately.  
obviously, i have not come the section in the book that talks about 
this, if there is one.  however, on my company's webstie, this is what 
i will be using js predominately for.
	based on your answer, you may be hearing from me more often.  
that, of course, may be a good or a bad thing.


  Return to Index