Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-12-2007, 04:02 PM   PM User | #1
Mhtml
Senior Coder

 
Mhtml's Avatar
 
Join Date: Jun 2002
Location: Sydney, Australia
Posts: 3,531
Thanks: 0
Thanked 1 Time in 1 Post
Mhtml is an unknown quantity at this point
Property list

I'm sending arrays of results from my server in response to an xmlhttprequest like so:

Code:
array({key:value[,...]}[,...]);
I know I could use an associative or indexed array, but this is just how I wrote it as I'm using the prototype library and I'm in the habit.

Anyway, I want to know if I can reference 'key'. If so, umm, how?
__________________
Omnis mico antequam dominus Spookster!
Mhtml is offline   Reply With Quote
Old 02-12-2007, 04:31 PM   PM User | #2
vwphillips
Senior Coder

 
Join Date: Mar 2005
Location: Portsmouth UK
Posts: 4,355
Thanks: 3
Thanked 458 Times in 445 Posts
vwphillips is a jewel in the roughvwphillips is a jewel in the roughvwphillips is a jewel in the rough
post you a std snippet which uses keys
Code:
function zxcES(zxcele,zxcstyle,zxcp,zxctxt){
 if (typeof(zxcele)=='string'){ zxcele=document.createElement(zxcele); }
 for (key in zxcstyle){ zxcele.style[key]=zxcstyle[key]; }
 if (zxcp){ zxcp.appendChild(zxcele); }
 if (zxctxt){ zxcele.appendChild(document.createTextNode(zxctxt)); }
 return zxcele;
}

  var zxcimg=zxcS('IMG',{position:'absolute',left:zxcw1+'px',top:(zxcImgAry1[zxc0][3]+476)+'px',width:zxcImgAry1[zxc0][1]+'px',height:zxcImgAry1[zxc0][2]+'px'},zxcp);
__________________
Vic

God Loves You and will never love you less.

http://www.vicsjavascripts.org.uk/

If my post has been useful please donate to http://www.operationsmile.org.uk/
vwphillips is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 06:15 PM.


Advertisement
Log in to turn off these ads.