Autor Beitrag
Stego
ontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 35

WIN XP
Delphi 2005 Archi.
BeitragVerfasst: Fr 02.02.07 13:10 
Hallo,
ich habe ein kleines Problem und Zwar folgendes:
Ich benötige eine Möglichkeit in JavaScript, wie ich bestimmte Bilder ansprechen kann, nun werdet ihr mir sicher sagen, das geht mit
ausblenden Quelltext
1:
document.images[x]					


Nur das Problem ist, das auf der Seite wo dieser Code ausgeführt wird, per Include (PHP) in eine Index-Seite eingebunden wird und da auf der Seite auch Bilder sind, müssten diese vorher mitbedacht werden.

Für die Eingebundene hab ich folgende Objekt-Hierarchie
- Seite
- Form ['FNews']
- Inputs ['Source'] / Bilder ['Bild']

Gibt es vielleicht noch ne Möglichkeit wie bei den Inputs, die Objekte nur im Form anzusprechen?
ausblenden Quelltext
1:
document.forms['FNews'].elements['Source'].item(x)					


Oder irgendetwas um alle Objekte mit dem namen "Bild" rauszusuchen und anzusprechen?
(Beispiel bei Inputs)
ausblenden Quelltext
1:
document.getElementsByName('Source').item(0)					



Wäre dankbar für eure Hilfe, ich komm einfach zu keiner Löschung :(

MFG Stego
wunsiedler
ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 506
Erhaltene Danke: 4

Win7

BeitragVerfasst: Sa 03.02.07 12:53 
Es gibt ein "foreach" in JS

for(i in objekt) wobei i nacheinander alle objekteigenschaften in der reihenfolge ihrer definition enthält.

also for(i in form) müsste dir dann alles aus der form bringen.

vielleicht hilfts....
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Sa 03.02.07 13:14 
Wie mein Vorredner bereits erwähnte: Verwende dazu einfach die ForEach-Schleife von JS und filtere in dieser mit if(i.id.substr(0,4) == 'image') deine Bilder heraus ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Stego Threadstarter
ontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 35

WIN XP
Delphi 2005 Archi.
BeitragVerfasst: Sa 03.02.07 22:16 
danke erstmal für eure antworten, aber das problem hat sich fast von selbst gelöst :)

ausblenden Quelltext
1:
document.getElementsByName("Bild")[x]