Bonjour,
Le but est d'appeler les fonctions javascript se trouvants dans un fichiers externe.
Voici les deux fichier php et javascript qui sont dans le même repertoire!!
Fichier php:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 <script language="javascript" type="text/javascript" src="resize-image.js"></script> <?php .....?>
Fichier javascript:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 // JavaScript Document function taille_max(arg,img_width,img_height,position){ var image = document.getElementById(arg.id); image.style.width=img_width+"px"; image.style.height=img_height+"px"; image.style.position=position; image.style.zIndex = 1; } function taille_min(arg,img_width,img_height,position){ var image = document.getElementById(arg.id); image.style.width=img_width+"px"; image.style.height=img_height+"px"; image.style.position=position; } function agrandir_img(product_sku,img_width,img_height,position){ var image = document.getElementById(product_sku); image.style.width=img_width+"px"; image.style.height=img_height+"px"; image.style.position=position; image.style.zIndex = 1; } function diminuer_img(product_sku,img_width,img_height,position){ var image = document.getElementById(product_sku); image.style.position=position; image.style.width=img_width+"px"; image.style.height=img_height+"px"; //image.style.border="2px solid #ffffff"; }
Malheureusement ça ne marche pas avec le fichier externe. Mais ça marche lorceque je copie les fonctions dans le fichier php!!
A l'aide
Merci
Partager