Gosh, most of them really. Lets say I have two identical javascripts. I
call both of them with an onload command. <script
type="text/javascript">window.onload=function(){image1();image2();}</script>Thing
is they both have identical other areas in the body section.
<a href="#" id="link" target="_blank"><img id="img" title="title"
border="0"></a>
<a href="#" id="link" target="_blank"><img id="img" title="title"
border="0"></a>
Since there are two identical slots to fill, the script doesn't know
what to do, and only one works. How to get around this problem?
Thankyou Amy
> > Hi using duplicate javascripts on the same page never work for me due
> > to the same property fields on the page twice. Anyone know how to get
[quoted text clipped - 3 lines]
>
> Val Polyakh
adamraney@gmail.com - 31 Oct 2006 19:05 GMT
In HTML, is you use the ID attribute on a tag, it needs to be unique.
You cannot have more than 1 element with the same ID. Here you have two
elements with id='img', which is not valid HTML. Plus, if you use
javascript's getElementById() command, it can only return 1 (I am
guessing the first one it finds).
Try using different IDs on your images and calling them appropriately.
> Gosh, most of them really. Lets say I have two identical javascripts. I
> call both of them with an onload command. <script
[quoted text clipped - 18 lines]
>
> > Val Polyakh
ASM - 01 Nov 2006 00:29 GMT
Amy a écrit :
> Gosh, most of them really. Lets say I have two identical javascripts. I
> call both of them with an onload command. <script
> type="text/javascript">window.onload=function(){image1();image2();}</script>Thing
> is they both have identical other areas in the body section.
if you have two time same function or same mane for 2 functions
(i.e image1() ) only the second will fire
(the 1st is scratched by the 2nd)
> <a href="#" id="link" target="_blank"><img id="img" title="title"
> border="0"></a>
[quoted text clipped - 4 lines]
> what to do, and only one works. How to get around this problem?
> Thankyou Amy
Having 2 elements with same id is forbidden !
Or do you mean that
image1() write 1st link
image2() write 2nd link (exactly same as 1st)
? ? ?
Nothing very clear about what you try to do ...
have links with different ids
and function 1 for link 1 and function 2 for link 2