Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



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

Posts: 23
Trades: 0
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]+'">';
	}
}
__________________

Please login or register to view this content. Registration is FREE

-------------------------------------------------------------------

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
webcord is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-22-2005, 12:34 PM
webcord's Avatar
Average Talker

Posts: 23
Trades: 0
this worked

if(window['dd_'+n.id])
__________________

Please login or register to view this content. Registration is FREE

-------------------------------------------------------------------

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
webcord is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Javascript Syntax
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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.10065 seconds with 12 queries