Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > JavaScript
JavaScript Forum programmation JavaScript. Lire : Cours JavaScript, FAQ JavaScript, Toutes les FAQ JavaScript et Sources JavaScript
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 25/11/2011, 11h51   #1
Invité régulier
 
Inscription : novembre 2008
Messages : 46
Détails du profil
Informations forums :
Inscription : novembre 2008
Messages : 46
Points : 6
Points : 6
Par défaut Vidéo lancée en JS

Bonjour à toutes et à tous,

Peut-on lancer une vidéo comme celle-ci:

Code :
<iframe width="800" height="657" src="http://www.youtube.com/embed/5mLPjxCBzKg?hl=fr&fs=1" frameborder="0" allowfullscreen></iframe>
A partir d'un code comme celui-ci:

Code :
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE HTML>
<html lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Titre</title>
<meta name="Author" content="NoSmoking">
<style type="text/css">
#page{
  margin:auto;
  width:1200px;
}
#div_bouton {
  width:250px;
  float:left;
  text-align:center;
}
#div_bouton p {
  margin:10px auto;
  text-align:center;
}
 
#div_image {
  width:525px;
  height:700px;
  float:left;
  border:1px solid #e0e0e0;
  box-shadow: 1px 1px 20px #333;
}
#image_grande {
  width:525px;
  height:700px;
}
 
button{
  border:0; padding:0; margin:0;
  width:200px; height:30px; /* dimensions des boutons (meme que image de fond) */
  font-weight:bold; font-size:1.2em; font-style:italic; /* texte des boutons */
  padding-top:5px; /* centrage vertical des textes */
  background: url(http://i45.servimg.com/u/f45/11/05/13/65/button61.jpg) center; /* image de fond des boutons */
  cursor:pointer;
}
button:hover {
  background: url(http://i45.servimg.com/u/f45/11/05/13/65/button62.jpg) center; /* image de fond des boutons (hover) */
}
</style>
<script type="text/javascript">
var picture = [
  'http://images3.photomania.com/1780499/1/rad88744.gif',/* Animation Chiens Mag */
  'http://images3.photomania.com/1780742/1/rad70F1C.gif',/* Animation Le Mans */
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_14.jpg',/* diapo 3 */ 
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_15.jpg',/* diapo 4 */
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_16.jpg',/* diapo 5 */
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_17.jpg',/* diapo 6 */
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_18.jpg',/* diapo 7 */
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_19.jpg',/* diapo 8 */
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_20.jpg',/* diapo 9 */  
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_21.jpg',/* diapo 10 */
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_22.jpg',/* diapo 11 */
  'http://i45.servimg.com/u/f45/11/05/13/65/coordo10.jpg' /* diapo 12 */
 
];
var maxPict = picture.length;
 
function showImage( num){
  var oImg = document.getElementById('image_grande');
  if( num < maxPict){
    oImg.src = picture[num];
  }
}
window.onload = function(){
  showImage(0);
};
</script>
</head><body>
<div id="page">
  <h1></h1>
  <div id="div_bouton">
    <p><button onclick="showImage(0);">Chiens de Mag</button></p>
    <p><button onclick="showImage(1);">Le Mans 2011</button></p>
    <p><button onclick="showImage(2);">Diaporama 3</button></p>
    <p><button onclick="showImage(3);">Diaporama 4</button></p>
    <p><button onclick="showImage(4);">Diaporama 5</button></p>
    <p><button onclick="showImage(5);">Diaporama 6</button></p>
    <p><button onclick="showImage(6);">Diaporama 7</button></p>
    <p><button onclick="showImage(7);">Diaporama 8</button></p>
    <p><button onclick="showImage(8);">Diaporama 9</button></p>
    <p><button onclick="showImage(9);">Diaporama 10</button></p>
    <p><button onclick="showImage(10);">Diaporama 11</button></p>
    <p><button onclick="showImage(11);">Nos Coordonn&eacute;es</button></p>
  </div>
  <div id="div_image">
    <img id="image_grande" src="..." alt="" />
  </div>
</div>
</body></html>
D'avance merci pour votre aide,
Cordialement,
Alban
Alban 56 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/11/2011, 14h13   #2
Modérateur
 
Avatar de NoSmoking
 
Homme
Inscription : janvier 2011
Messages : 2 944
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France, Isère (Rhône Alpes)

Informations forums :
Inscription : janvier 2011
Messages : 2 944
Points : 4 776
Points : 4 776
Bonjour,
essaies en ajoutant à l'url de la vidéo &autoplay=1
NoSmoking est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/11/2011, 16h06   #3
Invité régulier
 
Inscription : novembre 2008
Messages : 46
Détails du profil
Informations forums :
Inscription : novembre 2008
Messages : 46
Points : 6
Points : 6
Merci pour ton aide,

Avec &autoplay=1 la vidéo se lance toute seule quand elle est indépendante.

Mais quand je l'installe dans le scripte à la place de diapo 3 :

Code :
'http://i45.servimg.com/u/f45/11/05/13/65/diapo_14.jpg',/* diapo 3 */
Elle ne démarre pas du tout.
Alban 56 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/11/2011, 20h03   #4
Modérateur
 
Avatar de NoSmoking
 
Homme
Inscription : janvier 2011
Messages : 2 944
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France, Isère (Rhône Alpes)

Informations forums :
Inscription : janvier 2011
Messages : 2 944
Points : 4 776
Points : 4 776
il faut que tu ouvres ta vidéo dans une IFRAME en modifiant la scr de celle ci mais pas dans une IMG.
NoSmoking est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 28/11/2011, 06h13   #5
Invité régulier
 
Inscription : novembre 2008
Messages : 46
Détails du profil
Informations forums :
Inscription : novembre 2008
Messages : 46
Points : 6
Points : 6
Tu peux m'en dire un peu plus, je ne comprend pas.
Alban 56 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 28/11/2011, 19h28   #6
Modérateur
 
Avatar de NoSmoking
 
Homme
Inscription : janvier 2011
Messages : 2 944
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France, Isère (Rhône Alpes)

Informations forums :
Inscription : janvier 2011
Messages : 2 944
Points : 4 776
Points : 4 776
il te faut mettre une iframe dans ton document et en changer la source, attribut src

exemple :
Code html :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE HTML>
<html lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>[...]</title>
<style type="text/css">
#destination{
  width : 100%;
}
</style>
<script type="text/javascript">
function changeSource(){
  var oIframe = document.getElementById('destination');
  oIframe.src = "http://aka-cdn-ns.adtech.de/apps/36/Ad2881060St3Sz1Sq5149476V0Id3/developpez-728-2.gif";
}
</script>
</head>
<body>
<button onclick="changeSource();">Change</button>
<iframe id="destination" src="http://www.developpez.net/template/images/logo.gif"></iframe>
</body>
</html>
NoSmoking est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 05/12/2011, 15h28   #7
Invité régulier
 
Inscription : novembre 2008
Messages : 46
Détails du profil
Informations forums :
Inscription : novembre 2008
Messages : 46
Points : 6
Points : 6
Bonjour,

Cela fait plusieurs jours que j'essaie d'intégrer ton code dans celui-ci:

Code :
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE HTML>
<html lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Titre</title>
<meta name="Author" content="NoSmoking">
<style type="text/css">
#page{
  margin:auto;
  width:1200px;
}
#div_bouton {
  width:250px;
  float:left;
  text-align:center;
}
#div_bouton p {
  margin:10px auto;
  text-align:center;
}
 
#div_image {
  width:525px;
  height:700px;
  float:left;
  border:1px solid #e0e0e0;
  box-shadow: 1px 1px 20px #333;
}
#image_grande {
  width:525px;
  height:700px;
}
 
button{
  border:0; padding:0; margin:0;
  width:200px; height:30px; /* dimensions des boutons (meme que image de fond) */
  font-weight:bold; font-size:1.2em; font-style:italic; /* texte des boutons */
  padding-top:5px; /* centrage vertical des textes */
  background: url(http://i45.servimg.com/u/f45/11/05/13/65/button61.jpg) center; /* image de fond des boutons */
  cursor:pointer;
}
button:hover {
  background: url(http://i45.servimg.com/u/f45/11/05/13/65/button62.jpg) center; /* image de fond des boutons (hover) */
}
</style>
<script type="text/javascript">
var picture = [
  'http://images3.photomania.com/1780499/1/rad88744.gif',/* Animation Chiens Mag */
  'http://images3.photomania.com/1780742/1/rad70F1C.gif',/* Animation Le Mans */
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_14.jpg',/* diapo 3 */ 
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_15.jpg',/* diapo 4 */
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_16.jpg',/* diapo 5 */
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_17.jpg',/* diapo 6 */
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_18.jpg',/* diapo 7 */
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_19.jpg',/* diapo 8 */
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_20.jpg',/* diapo 9 */  
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_21.jpg',/* diapo 10 */
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_22.jpg',/* diapo 11 */
  'http://i45.servimg.com/u/f45/11/05/13/65/coordo10.jpg' /* diapo 12 */
 
];
var maxPict = picture.length;
 
function showImage( num){
  var oImg = document.getElementById('image_grande');
  if( num < maxPict){
    oImg.src = picture[num];
  }
}
window.onload = function(){
  showImage(0);
};
</script>
</head><body>
<div id="page">
  <h1></h1>
  <div id="div_bouton">
    <p><button onclick="showImage(0);">Chiens de Mag</button></p>
    <p><button onclick="showImage(1);">Le Mans 2011</button></p>
    <p><button onclick="showImage(2);">Diaporama 3</button></p>
    <p><button onclick="showImage(3);">Diaporama 4</button></p>
    <p><button onclick="showImage(4);">Diaporama 5</button></p>
    <p><button onclick="showImage(5);">Diaporama 6</button></p>
    <p><button onclick="showImage(6);">Diaporama 7</button></p>
    <p><button onclick="showImage(7);">Diaporama 8</button></p>
    <p><button onclick="showImage(8);">Diaporama 9</button></p>
    <p><button onclick="showImage(9);">Diaporama 10</button></p>
    <p><button onclick="showImage(10);">Diaporama 11</button></p>
    <p><button onclick="showImage(11);">Nos Coordonn&eacute;es</button></p>
  </div>
  <div id="div_image">
    <img id="image_grande" src="..." alt="" />
  </div>
</div>
</body></html>
Et je n'y arrive pas
Alban 56 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/12/2011, 15h31   #8
Modérateur
 
Avatar de NoSmoking
 
Homme
Inscription : janvier 2011
Messages : 2 944
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France, Isère (Rhône Alpes)

Informations forums :
Inscription : janvier 2011
Messages : 2 944
Points : 4 776
Points : 4 776
as tu essayé un simple remplacement de l'IMG par l'IFRAME
Code html :
1
2
3
4
  <div id="div_image">
    <iframe id="image_grande" src=""></iframe>
<!--  <img id="image_grande" src="..." alt="" /> -->
  </div>
NoSmoking est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/12/2011, 09h38   #9
Invité régulier
 
Inscription : novembre 2008
Messages : 46
Détails du profil
Informations forums :
Inscription : novembre 2008
Messages : 46
Points : 6
Points : 6
Bonjour et merci pour ton aide,

J'ai essayé ça:

Code :
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
ESSAI POUR LANCER VIDEO
 
<!DOCTYPE HTML>
<html lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Titre</title>
<meta name="Author" content="NoSmoking">
<style type="text/css">
#page{
  margin:auto;
  width:1200px;
}
#div_bouton {
  width:250px;
  float:left;
  text-align:center;
}
#div_bouton p {
  margin:10px auto;
  text-align:center;
}
 
#div_image {
  width:525px;
  height:700px;
  float:left;
  border:1px solid #e0e0e0;
  box-shadow: 1px 1px 20px #333;
}
#image_grande {
  width:525px;
  height:700px;
}
 
button{
  border:0; padding:0; margin:0;
  width:200px; height:30px; /* dimensions des boutons (meme que image de fond) */
  font-weight:bold; font-size:1.2em; font-style:italic; /* texte des boutons */
  padding-top:5px; /* centrage vertical des textes */
  background: url(http://i45.servimg.com/u/f45/11/05/13/65/button61.jpg) center; /* image de fond des boutons */
  cursor:pointer;
}
button:hover {
  background: url(http://i45.servimg.com/u/f45/11/05/13/65/button62.jpg) center; /* image de fond des boutons (hover) */
}
</style>
<script type="text/javascript">
var picture = [
  'http://images3.photomania.com/1780499/1/rad88744.gif',/* Animation Chiens Mag */
  'http://images3.photomania.com/1780742/1/rad70F1C.gif',/* Animation Le Mans */
  '<div id="div_image">
    <iframe id="image_grande" src=""></iframe>
<!--  <img id="image_grande" src="..." alt="" /> -->
  </div>
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_15.jpg',/* diapo 4 */
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_16.jpg',/* diapo 5 */
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_17.jpg',/* diapo 6 */
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_18.jpg',/* diapo 7 */
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_19.jpg',/* diapo 8 */
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_20.jpg',/* diapo 9 */  
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_21.jpg',/* diapo 10 */
  'http://i45.servimg.com/u/f45/11/05/13/65/diapo_22.jpg',/* diapo 11 */
  'http://i45.servimg.com/u/f45/11/05/13/65/coordo10.jpg' /* diapo 12 */
 
];
var maxPict = picture.length;
 
function showImage( num){
  var oImg = document.getElementById('image_grande');
  if( num < maxPict){
    oImg.src = picture[num];
  }
}
window.onload = function(){
  showImage(0);
};
</script>
</head><body>
<div id="page">
  <h1></h1>
  <div id="div_bouton">
    <p><button onclick="showImage(0);">Chiens de Mag</button></p>
    <p><button onclick="showImage(1);">Le Mans 2011</button></p>
    <p><button onclick="showImage(2);">Diaporama 3</button></p>
    <p><button onclick="showImage(3);">Diaporama 4</button></p>
    <p><button onclick="showImage(4);">Diaporama 5</button></p>
    <p><button onclick="showImage(5);">Diaporama 6</button></p>
    <p><button onclick="showImage(6);">Diaporama 7</button></p>
    <p><button onclick="showImage(7);">Diaporama 8</button></p>
    <p><button onclick="showImage(8);">Diaporama 9</button></p>
    <p><button onclick="showImage(9);">Diaporama 10</button></p>
    <p><button onclick="showImage(10);">Diaporama 11</button></p>
    <p><button onclick="showImage(11);">Nos Coordonn&eacute;es</button></p>
  </div>
  <div id="div_image">
    <img id="image_grande" src="..." alt="" />
  </div>
</div>
</body></html>
Mais je ne maitrise pas ce langage, je n'y arrive pas
Alban 56 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 17/12/2011, 09h21   #10
Modérateur
 
Avatar de NoSmoking
 
Homme
Inscription : janvier 2011
Messages : 2 944
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France, Isère (Rhône Alpes)

Informations forums :
Inscription : janvier 2011
Messages : 2 944
Points : 4 776
Points : 4 776
le code que je t'ai indiqué doit prendre place dans la partie HTML, entre les balises <BODY> et </BODY> et non dans la partie javascript.
NoSmoking est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 07h21.


 
 
 
 
Partenaires

Hébergement Web