Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #22778

Javascript conflicts

Newsgroups comp.lang.javascript
Date 2014-01-24 14:58 -0800
Message-ID <deee7c09-9d64-4b16-a668-bdb8dc747c80@googlegroups.com> (permalink)
Subject Javascript conflicts
From WanWan <jippijappo@hotmail.com>

Show all headers | View raw


How do I solve this?
My script is intended to be inserted like this:

<script type="text/javascript" id="id1">var myId="id1";</script>
<script type="text/javascript" src="myScript.js"></script>

then another place on the page:

<script type="text/javascript" id="id2">var myId="id2";</script>
<script type="text/javascript" src="myScript.js"></script>

and so on.
Where and how many times I cannot control. And where the script is, indicates where the "action" should happen.

The problem here is that the the "unique identifier" (id1, id2 ...) for each script written to the same variable, so it gets the value that is set at last before the script runs several times.

Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Javascript conflicts WanWan <jippijappo@hotmail.com> - 2014-01-24 14:58 -0800
  Re: Javascript conflicts "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-01-25 00:03 +0100
  Re: Javascript conflicts Denis McMahon <denismfmcmahon@gmail.com> - 2014-01-24 23:09 +0000
    Re: Javascript conflicts WanWan <jippijappo@hotmail.com> - 2014-01-25 13:40 -0800

csiph-web