Using array in javascript? -


the jsp page not recognizing array aa[] in line document.dd.aa[i].value.... specific dd form name....

<script type="text/javascript"> function chk() {     var errmsg = new string("");     var aa = new array("t1","t2");     for(var i=0;i<=1;i++)         {            var ddd = document.dd.aa[i].value;            if(ddd=="")                {                   errmsg += "empty field:" +"\n";                }         }         alert(errmsg); } </script> 

thx in advance :dd...

var aa = new array("t1","t2");  

above not part of form. var ddd = document.dd.aa[i].value; wrong.

you can directly access aa array. this.

var ddd = aa[i]; 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -