Probleme de concatenation

Probleme de concatenation - HTML/CSS - Programmation

Marsh Posté le 07-12-2004 à 12:16:49    

j'ai fait une fonction JS
 

Code :
  1. function affichetypo(formname,image){
  2. var typo;
  3. if(document.form2.+formname+.options[document.form2.+formname+.selectedIndex].value)
  4. {
  5. typo=document.form2.+formname+.options[document.form2.+formname+.selectedIndex].value;
  6. typo=typo.replace("afm","jpg" );
  7. document.+image+.src = '/php/ezpdf/fonts/ttfimgs/tiny_'+typo;
  8. }
  9. }


 
comme vous pouvez le voir j'ai tenté une concatenation... en fonction d'un attribut de ma fonction.. Mais ça marche pas comme ça... :-(  
 
où est l'erreur ?

Reply

Marsh Posté le 07-12-2004 à 12:16:49   

Reply

Marsh Posté le 07-12-2004 à 12:26:28    

J'ai tenté avec GetElementById :
 

Code :
  1. function affichetypo(formname,image){
  2. var typo;
  3. if(document.getElementById(formname).value)
  4. {
  5. typo=document.getElementById(formname).value;
  6. typo=typo.replace("afm","jpg" );
  7. document.getElementById(image).src = '/php/ezpdf/fonts/ttfimgs/tiny_'+typo;
  8. }
  9. }


 
... mais en vain !


Message édité par freed102 le 07-12-2004 à 12:26:49
Reply

Marsh Posté le 07-12-2004 à 12:28:13    

Haaaaaaaa !! si ça marche ! :)

Reply

Marsh Posté le 07-12-2004 à 13:52:15    

tu pourrais au moins te remercier :D

Reply

Sujets relatifs:

Leave a Replay

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