Creer une boîte de dialogue

Résolu
guill76 Messages postés 193 Date d'inscription mercredi 24 août 2005 Statut Membre Dernière intervention 3 juin 2016 - 26 oct. 2005 à 19:43
guill76 Messages postés 193 Date d'inscription mercredi 24 août 2005 Statut Membre Dernière intervention 3 juin 2016 - 26 oct. 2005 à 22:30
Bonjour, je bute sur un petit pb:
J'aimerais ouvrir à l'intérieur de la page de mon site une petite boîte de dialogue afin que l'utilisateur puisse envoyer un formulaire .
Le problème est que le code que j'ai fabriqué m'ouvre une page vierge avec le formulaire en question àl'intérieur,mais moi je le voudrais dans ma page .
Suis je rééllement obligé d'ouvrir un div dans ma page pour que mon script l'alimente ou y a til une autre soluce voici mon code:
Merci pour vos réponse ..
Mon code sera + lisible dans un éditeur

function dlgBox (aname,cx,cy,pathn) {

window.document.writeln('

');
window.document.writeln('
');
window.document.writeln('');
if (aname==\"create\") {
window.document.writeln('NOUVEAU DOSSIER :, , ----
');
window.document.writeln(\"<form action=\\"index.php?dir=\"+pathn+\"\\" method=\\"post\\">\");
window.document.writeln('');
window.document.writeln(', ');
window.document.writeln('');
window.document.writeln('');
window.document.writeln(', </form>');
}
window.document.writeln('

');
}

3 réponses

guill76 Messages postés 193 Date d'inscription mercredi 24 août 2005 Statut Membre Dernière intervention 3 juin 2016
26 oct. 2005 à 21:40
c'est bon j'ai changé mon code
En plus ça créé la boite exactement à l'endroit ou se trouve la souris
Le voici:

function dlgBox (aname,cx,cy,pathn) {

var html;
if ( window.document.getElementById("workzone") ) {
window.document.getElementById("workzone").innerHTML="";
window.document.getElementById("workzone").style.top=cy;
window.document.getElementById("workzone").style.left=cx;
}
html=''+
'NOUVEAU DOSSIER :, , ----
'+
'<form action=\"index.php?dir='+pathn+'\" method=\"post\">'+
''+
', '+
''+
''+
', </form>'+
'
';
window.document.getElementById("workzone").innerHTML=html;
}
3
guill76 Messages postés 193 Date d'inscription mercredi 24 août 2005 Statut Membre Dernière intervention 3 juin 2016
26 oct. 2005 à 19:52
PS:Avant je le faisais en php mais je préfererais le faire coté client pour faciliter la navigation .
0
guill76 Messages postés 193 Date d'inscription mercredi 24 août 2005 Statut Membre Dernière intervention 3 juin 2016
26 oct. 2005 à 22:30
Voici une nouvelle version revue et corrigée et la dernière pour ceux que ça interresse:
Pas besoin de passer en paramètre les coordonnées de la souris:+exple d'utilisation
<html>
<head>
<script language="javascript">

function dlgBox (aname,pathn) {

var html="";
if ( window.document.getElementById("workzone") ) {
window.document.getElementById("workzone").innerHTML="";
window.document.getElementById("workzone").style.top=event.clientY-55;
window.document.getElementById("workzone").style.left=event.clientX-15;
window.document.getElementById("workzone").style.visibility="visible";
}

if ( aname=="create" ) {
html =''+
'NOUVEAU DOSSIER :, , ----
'+
'<form action=\"index.php?dir='+pathn+'\" method=\"post\">'+
''+
', '+
''+
''+
', </form>'+
'
';
}
if ( aname=="find" ) {
html =''+
'RECHERCHER :, , ----
'+
'<form action=\"index.php?dir='+pathn+'\" method=\"post\">'+
''+
', '+
''+
''+
', </form>'+
'
';
}
window.document.getElementById("workzone").innerHTML=html;
}
</script>
</head>

#le 2 eme parametre ne sert que dans mon cas pour afficher le repertoire courant
#je fais une gestion de système de fichiers web en php et javascript



</html>
0
Rejoignez-nous