[Javascript] Accéder à un champ à partir d'une autre page

Accéder à un champ à partir d'une autre page [Javascript] - HTML/CSS - Programmation

Marsh Posté le 17-09-2006 à 17:11:22    

Bonjour,
 
Je tient d'abord à signaler que je n'y connait presque rien en javascript mais malheureusement j'en ait besoin pour faire ce que je veux faire :
 
J'ai une page html qui contient ceci:

....
<script language="javascript">
 function popup(page,largeur,hauteur,options){
  var top=(screen.height-hauteur)/2;
  var left=(screen.width-largeur)/2-16;
  window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
 }
</script>
 
....
<form name="form1">
 <input type="text" id="avatar" name="avatar" size="7" maxlength="3" />
 <a href="javascript:popup('showAvatars.htm','366','400','scrollbars=no')">Sélectionner</a>
</form>


 
Ce que j'aimerais c'est pourvoir modifier la valeur du champ "avatar" à partir de la popup "showAvatar.htm".
 
Mais comment faire pour accéder au champ "avatar" ?
Je supose que ça doit être un truc du genre : "window_parent.document.forms["form1"].avatar"
 
Merci d'avance...


Message édité par casafa le 17-09-2006 à 17:13:25
Reply

Marsh Posté le 17-09-2006 à 17:11:22   

Reply

Marsh Posté le 17-09-2006 à 17:50:10    

Code :
  1. window.opener.document.getElementById('avatar')


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box, and replicate and expand beyond their wildest dreams by throwing away the limits imposed by overbearing genetic r
Reply

Marsh Posté le 17-09-2006 à 18:10:37    

Merci ça fonctionne ;)

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed