Replace src

E

Emmanuel Soheyli

I get information from an outside site by the following code:

<script src="http://www.outside.com/page.asp?id=1"></script>

It generates array 'content with all necessaries information. The problem is
I need several type of information (id=2,3, etc.), and it always generate
the same array content (as name) with different contents .how can I change
the name of the array to other things in order to get different arrays. Any
help would be greatly appreciated.
 
G

Greg

Emmanuel Soheyli said:
I get information from an outside site by the following code:

<script src="http://www.outside.com/page.asp?id=1"></script>

It generates array 'content with all necessaries information. The problem is
I need several type of information (id=2,3, etc.), and it always generate
the same array content (as name) with different contents .how can I change
the name of the array to other things in order to get different arrays. Any
help would be greatly appreciated.

Dunno if I understand your question or not, but if you are importing
several variables with the same name, you might just copy the values
each time, as:

// x.js
var bill = 'x';

//y.js
var bill = 'y';

// a.htm
<script type='text/javascript'>
var bills = [];
</script>
<script type='text/javascript' src='x.js' ></script>
<script type='text/javascript'>
bills[0] = bill;
</script>
<script type='text/javascript' src='y.js' ></script>
<script type='text/javascript'>
bills[1] = bill;
var s = '';
for(var i = 0; i < bills.length; i++){
s += i + ': ' + bills + "\n";
}
alert(s);
</script>


Just a thought.

Not an expert, so FWIW.
 
E

Emmanuel Soheyli

Thank you for your reply, and it was a very genial solution, but I got the
same result. Maybe I didn't use it correctly. Let me explain what exactly is
going on. this script <script src="http://source.asp?id=1> generates an
array named content and it fills this array with content[0]= text0,
content[1]=text1 etc.

on my page I have the following code

<script src="http://source.asp?id=1>

<script> Content1 = content

some codes to treat the content1.

</script>

<script src="http://source.asp?id=2>

<script> Content2 = content

some codes to treat the content2.

</script>

but Content1 is filled by the result of the last call and I'm loosing the
first array of data. Thanks again for any other ideas.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,575
Members
47,207
Latest member
HelenaCani

Latest Threads

Top