Reply
Javascript Syntax
Old 02-21-2005, 12:39 PM Javascript Syntax
webcord's Avatar
Average Talker

Posts: 23
Im trying to check if an array is defined while looping through another array
I've been beating my head on syntax options for awhile now.

here's what I got:
Code:
if(eval('self.dd_'+n.id+'[0][0]'))
      alert(msg)


This the code in context with function

Code:
function openform(id){
	//change button to 'save'
	obj.childNodes[b_pos].firstChild.value='save';
	
	//store values in array	
	var v=0; vArray=new Array(new Array(),new Array(),new Array());
	for (i=0; i < obj.childNodes.length; i++){
		n=obj.childNodes[i]
		if (n.id){
		 	vArray[0][v]=i;	
			vArray[1][v]=n.innerHTML; 
			vArray[2][v]=(n.innerText!=undefined?n.innerText:n.textContent)
			v++;			
		}
	}

	//write input boxes
	for (i=0; i < vArray[0].length; i++){
		n=obj.childNodes[vArray[0][i]];
		w=n.clientWidth;


//>>>>>>> BEGIN PROBLEM AREA <<<<<<<<<<

		if(eval('self.dd_'+n.id+'[0][0]'))
                      alert(msg)
		else 
                      alert("self.dd_"+n.id+"[0][0] is not defined")

		
//>>>>>>> END PROBLEM AREA <<<<<<<<<<

		inputwidth=(w>200?30:(w>50?8:1));
		n.innerHTML='<input name="'+n.id+'" size="'+inputwidth+'" value="'+vArray[2][i]+'">';
	}
}
__________________
Scott Yardley
-------------------------------------------------------------------
baby clipart diet info christian clipart
webcord is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 02-22-2005, 11:34 AM
webcord's Avatar
Average Talker

Posts: 23
this worked

if(window['dd_'+n.id])
__________________
Scott Yardley
-------------------------------------------------------------------
baby clipart diet info christian clipart
webcord is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Javascript Syntax
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11085 seconds with 12 queries