Replace src

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Emmanuel Soheyli

    Replace src

    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.





  • HikksNotAtHome

    #2
    Re: Replace src

    In article <u832b.4338$Jq1 .3220@nwrddc03. gnilink.net>, "Emmanuel Soheyli"
    <vzd1s1jh@veriz on.net> writes:
    [color=blue]
    >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.[/color]

    Assuming you are wanting to make repeated calls to the same asp page to get
    different results back?

    Simply set a new array = to the existing array
    myArray = new Array()
    //definitions for myArray

    myArray2 = myArray;

    //myArray2 is now a complete copy of myArray

    Hope this helps.


    --
    Randy
    All code posted is dependent upon the viewing browser
    supporting the methods called, and Javascript being enabled.

    Comment

    • Greg

      #3
      Re: Replace src

      "Emmanuel Soheyli" <vzd1s1jh@veriz on.net> wrote in message news:<u832b.433 8$Jq1.3220@nwrd dc03.gnilink.ne t>...[color=blue]
      > 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.[/color]

      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[i] + "\n";
      }
      alert(s);
      </script>


      Just a thought.

      Not an expert, so FWIW.

      Comment

      • Emmanuel Soheyli

        #4
        Re: Replace src

        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.

        "HikksNotAtHome " <hikksnotathome @aol.com> wrote in message
        news:2003082417 0606.07346.0000 0183@mb-m26.aol.com...[color=blue]
        > In article <u832b.4338$Jq1 .3220@nwrddc03. gnilink.net>, "Emmanuel Soheyli"
        > <vzd1s1jh@veriz on.net> writes:
        >[color=green]
        > >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[/color][/color]
        is[color=blue][color=green]
        > >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[/color][/color]
        change[color=blue][color=green]
        > >the name of the array to other things in order to get different arrays.[/color][/color]
        Any[color=blue][color=green]
        > >help would be greatly appreciated.[/color]
        >
        > Assuming you are wanting to make repeated calls to the same asp page to[/color]
        get[color=blue]
        > different results back?
        >
        > Simply set a new array = to the existing array
        > myArray = new Array()
        > //definitions for myArray
        >
        > myArray2 = myArray;
        >
        > //myArray2 is now a complete copy of myArray
        >
        > Hope this helps.
        >
        >
        > --
        > Randy
        > All code posted is dependent upon the viewing browser
        > supporting the methods called, and Javascript being enabled.[/color]


        Comment

        Working...