[Javascript] Function() troebel

Pagina: 1
Acties:

  • IceEyz
  • Registratie: Juni 2002
  • Laatst online: 22-08 19:05
<script type="text/javascript">
function handle1(rad) {

var state;
playerStatus = document.radio(rad).playState;
if (playerStatus == 0) {
document.radio(rad).play();
document.playerCtrl.playOrPause.value = " Stop ";
}
...enz...}
Bedoeling is dus dat zodra de functie wordt geroepen document.radio"X".play() wordt uitgevoerd, waarbij "X" een getal is dat aangewezen is bij het aanroepen van de functie. Bijv. "radio5" is het id van een object.

Dit werkt dus blijkbaar niet.
Hoe krijg ik dus dat argument werkend in de functie?

  • Clay
  • Registratie: Oktober 1999
  • Laatst online: 22-06 13:51

Clay

cookie erbij?

document["radio" + rad].play()

Instagram | Flickr | "Let my music become battle cries" - Frédéric Chopin


  • IceEyz
  • Registratie: Juni 2002
  • Laatst online: 22-08 19:05
Dat alles om één puntje...
Thx :)

  • Guillome
  • Registratie: Januari 2001
  • Niet online

Guillome

test

document.getElementById("radio" + rad).play()

If then else matters! - I5 12600KF, Asus Tuf GT501, Gigabyte Gaming OC 16G 5080 RTX, Asus Tuf Gaming H670 Pro, 48GB, Corsair RM850X PSU, SN850 1TB, Arctic Liquid Freezer 280, ASUS RT-AX1800U router