Jump to content

key value pairing from string


sandy1028

Recommended Posts



var content = "javascript:(function() {document.open();document.write("<script>abc = '37418';adt = '484';h = '585';w = '111';nel = '12482,100';test = 'on';num = '1';</script><script type='text/javascript' src='http://abc.js'></script>");document.close();})()";

abc = '37418';

adt = '484';

 


 

Can you please help in  extracting the key and value pairs in the string and print the value of particular value for the key. Please help

 

 

 

 

Link to comment
Share on other sites

 



var content = "javascript:(function() {document.open();document.write("<script>abc = '37418';adt = '484';h = '585';w = '111';nel = '12482,100';test = 'on';num = '1';</script><script type='text/javascript' src='http://abc.js'></script>");document.close();})()";


 

In the variable "content", I want to get the all the values which has 

aaa = 'xyx' ,etc. 

 

When called using a['aaa'] then output should give the proper result as "xyx".

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.