bonsoir
j'ai fais un script qui liste tous les fichier dans un répertoire , je voulais faire l'effet afficher masquer des sous répertoires mais j'y arrive pas a bien mettre en la fonction afficher masquer des div un coup de main serai le bienvenu
merci
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 #!c:\\Python27\\python.exe import os print "content-type:text/html\n\n" print """<html> <head>""" print "<base target='toto'>" print """<script language="javascript" type="text/javascript"> function bascule(elem) { etat=document.getElementById(elem).style.display; if(etat=="none"){ document.getElementById(elem).style.display="block"; } else{ document.getElementById(elem).style.display="none"; } } </script>""" print """</head> <body>""" ################ def parcours (repertoire): liste=os.listdir(repertoire) if os.path.isdir(repertoire): for fichier in liste: if os.path.isdir(repertoire+"/"+fichier): print "<div id= 1 ><a href= contenu.cgi?rep="+repertoire+"/"+fichier+" target='toto' ><img src=http://localhost/cgi-bin/folder.gif></br>"+fichier+"</a>" print"<div id = 2 style= display:none >" parcours(repertoire+"/"+fichier) print "</div>" print "</div>" parcours("c:/wamp/www") print"</div>" print"""</BODY> </html>"""
Partager