473,378 Members | 1,469 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

can we fetch the comma separated values of dcsMultiTrack in HTML page

10
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">dcsMultiTrack('DCS.dcsuri','/a/b/c/d/e','DCS.dcsqry','_ABC=ABC_0001','DCSext.error_code','abc500','DCSext.error_desc','FAILURE','DCSext.error_type','ABC Error','DCSext.RegType','ABC Registration','DCSext.RegStep','ABC Entry');</script>
Suppose, there is a script with dcsMultiTrack method with its comma seperated values in the HTML page (as shown above).

Is it possible to fetch each of these comma seperated using JavaScript function at page load? Can someone please help me out and share the code snippet for the same.

Thanks in Advance!
Jul 17 '10 #1
5 2668
gits
5,390 Expert Mod 4TB
so the parameters of that tracking function are always different? is that script added to the page automatically without having control over it?
Jul 19 '10 #2
amkohl
10
@gits
Yes, it will be different for different scenarios. Here, our main concern is to first traverse the page and check if the value of 'DCS.dcsqry' is '_ABC=ABC_0001'. If yes, then we will stor this value in a variable for analysis.

Secondly,this script is added through a code within <body> tag and yes, we do not have control over it.

I hope this answers all your queries.

Appreciate your help!
Thanks!
Jul 19 '10 #3
gits
5,390 Expert Mod 4TB
here is an example for what you might do:

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. // dummy function for test - we need a declared one
  3. function dcsMultiTrack() {
  4. }
  5.  
  6. function getDcsMultiTrackParams() {
  7.     var scripts = document.getElementsByTagName('script');
  8.  
  9.     for (var i = 0; n = scripts[i]; ++i) {
  10.         var jsCode = n.innerHTML;
  11.  
  12.         if (/^dcsMultiTrack\(/.test(jsCode)) {
  13.             var paramsString = jsCode.match(/[^dcsMultiTrack\(]([^)]+)/)[0];
  14.             var paramsArray  = paramsString.split(',');
  15.  
  16.             alert(paramsArray);
  17.         }
  18.     }
  19. }
  20.  
  21. </script>
  22. <script type="text/javascript">dcsMultiTrack('DCS.dcsuri','/a/b/c/d/e','DCS.dcsqry','_ABC=ABC_0001','DCSext.error_code','abc500','DCSext.error_desc','FAILURE','DCSext.error_type','ABC Error','DCSext.RegType','ABC Registration','DCSext.RegStep','ABC Entry');</script>
  23.  
  24. <body onload="getDcsMultiTrackParams();">
  25. </body>
  26.  
it alerts the extracted params array that are passed to the dcsMultiTrack-method.
Jul 19 '10 #4
amkohl
10
@gits
Many Thanks for the help!

As I mentioned earlier, we DO NOT have access to the HTML page in which this below script is embedded.So, this JS method and body onload function is not possible.

Possibly,can we try it by using some external JS to fetch these comma separated values within the HTML?

Note - We have a framework through which we can add an external JS to the same HTML at page load.

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">dcsMultiTrack('DCS.dcsuri','/a/b/c/d/e','DCS.dcsqry','_ABC=ABC_0001','DCSext.error_code','abc500','DCSext.error_desc','FAILURE','DCSext.error_type','ABC Error','DCSext.RegType','ABC Registration','DCSext.RegStep','ABC Entry');</script>
Jul 20 '10 #5
gits
5,390 Expert Mod 4TB
if the page is on another domain then it is not possible due to the same origin policy ... if not you might retrieve it the same way as i showed you from another frame by refering everything to the corresponding frame ...

if there are no frames then you could add an external script and you would need to extend the onload-handler in it to call the retrieve-script in that external script ...
Jul 20 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: RogerTBrick | last post by:
Cheers for the help last time guys. Again this is probably dead simple but try as I might, I just can't work it out. THe XML file I am being give contains some code value that need to be...
1
by: idog | last post by:
If I start off with a string which contains comma separated ints. I want to move this into an int array so i can do sorting. I thought I might get this to work: int test = {textBox1.Text}; ...
2
by: RD | last post by:
S= myTxtStrean.Readline gives me a string. How do I extract the fields separated by commas for instance 1,123456,345632,7876543 1,234567890,5432,87654 (values are not each the same length) ...
3
by: mahe23 | last post by:
All, How do One convert a comma separated column from a text file into rows in oracle. I have a scenario where the list of comma separated values changes dynamically. It is like: abc, ttt,...
3
by: shark | last post by:
Hi All, i hv created a sp as Create proc P @iClientid varchar (100) as Begin select * from clients where CONVERT(VACHAR(100),iClientid) in( @iclientid)
1
by: alister joseph | last post by:
hi I have two tables, i have to combine them & a column should contain comma separated value. example 1 a 2 b 2 c 2 d 3 a
1
by: shaji66 | last post by:
how to update values in HTML page using java script: hi all , I want to update some text fields in html , and display these values in another page .... can you please help me in writing...
4
by: flavourofbru | last post by:
Hi, In the datagridview control, one of my column has multiple values separated by a comma Is there a way to get individaual values which are separated by a comma from that particular cells? ...
10
by: Tony Johansson | last post by:
Hello! What does it mean when it says that there is no information about the data types of the data extracted from a CSV file. Can somebody this. //Tony
3
by: anil2083 | last post by:
How to migrate the comma separated values from one table to another table? suppose we have table i.e XYZ and we have comma separated values in few columns i.e( column_name and values are...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.