Bonjour,
Comment affiche une variable JS dans un code JS de façon dynamique ? [Pour avoir un chemin dynamique] (Sans document.write puis supprime tout autre code)
dans le code ces la variable passer en paramétré à la fonction "i_aspirateur" qui n'est pas interpréter ? (sa valeur ne change pas dynamiquement, ces considérais comme une chaîne de caractère !! pour quoi je ces pas)
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
55
56
57
58
59
60
61
62
63
64
65 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" > <head> <title>Titre</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" /> <script type="text/javascript" src="script/jquery1.5.2.js"></script> </head> <body> <script type='text/javascript'> var lien = new Array(); var nbLien = 10; $(document).ready( function() { $.ajax( { type: 'GET', url: './list/dir.html', dataType: 'html', success: function(xml) { $(xml).find('table[id=\'list\']').each( function() { //var id = $(this).attr('id'); $('<div class=\'items\' id=\'link_0\'></div>').html('<a href=\'#\'>Nom : title1 / Adersse : title</a>').appendTo('#Div_XML'); $(this).find('a').each( function() { var brief = $(this).attr('href'); //alert(brief); for(j=0; j<nbLien; j++) lien[j]=brief; $('<div class=\'brief\'></div>').html(brief).appendTo('#link_0'); }); // alert(lien.length); for(i=0; i< lien.length; i++) //alert("LIEN : "+lien[i]); { f_serch = lien[i]; alert("LIEN : "+f_serch); i_aspirateur(f_serch); } }); } }); } ); </script> <!-- le contenu --> <div id="Div_XML"></div> </body> </html>Cordialement
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 function i_aspirateur(f_serch) { $(document).ready( function() { $.ajax( { type: 'GET', url: '"+f_serch+"', dataType: 'html', success: function(xml) { $(xml).find('div[class="company_description"]').each( function() { //var id = $(this).attr('id'); var title1 = $(this).find('div[class="title_h2"]').text(); //alert("affiche:"+title1); var title = $(this).find('p').text(); $('<div class="items" id="link_0"></div>').html('<a href=\'#\'>Nom : ' + title1 +' / Adersse : '+ title + '</a>').appendTo('#Div_XML'); $(this).find('div[class="contact_the_company"]').each( function() { var brief = $(this).find('li[id^="phone_number_"]').text(); var long = $(this).find('li[id^="fax_number_"]').text(); $('<div class=\'brief\'></div>').html(brief).appendTo('#link_".$key."'); $('<div class=\'long\'></div>').html(long).appendTo('#link_".$key."'); }); }); } }); } ); }
Partager