Wrox Programmer Forums
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript 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 July 21st, 2006, 02:42 AM
Authorized User
 
Join Date: May 2006
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default Accessing Controls

hi i have a javascript function as follows
Code:
function fnIsTextBoxEmpty(frmName,ctrlName) {
  if(frmName.ctrlName.value == "")
    return true;
  else 
    return false;
}
Now this is called as follows
Code:
var frm = document.forms[0];

if(fnIsTextBoxEmpty(frm,'name'))
   alert("Empty");
'name' is a textbox.

The problem here is that the function fnIsTextBoxEmpty does not take the 'name' as the control name but the 'ctrlName'.

I am aware that i can use document.getElementById but it I know that this is not available for Netscape.
Also i hear that eval() is not very reliable so i dont want to use it.

So Plz can someone tell me the solution

Thanks






Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing the Controls of a User Control? Aaron Edwards ASP.NET 2.0 Basics 6 June 16th, 2006 07:22 PM
Accessing Controls in FormView cryspe ASP.NET 2.0 Basics 0 May 16th, 2006 03:59 PM
Accessing Controls in Web Form BSkelding ASP.NET 1.0 and 1.1 Professional 1 March 24th, 2005 04:48 PM
Accessing controls in another form Ramakrishna General .NET 1 September 6th, 2004 10:05 AM





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