begin process at 2012 05 29 07:18:49
  Trouver un code source :
 
dans
 
Accueil > Forum > 

Archive Javascript

 > 

Archives

 > 

Débutants

 > 

Creer une boîte de dialogue


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

Creer une boîte de dialogue

mercredi 26 octobre 2005 à 19:43:04 | Creer une boîte de dialogue

guill76

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('<div style="height:20px; overflow: none" ></div>');
 window.document.writeln('<div id="workzone" style="width:25%; height:95px; overflow: auto; position:absolute; top:'+cy+'; left:'+cx+'; border-style:solid; border-color:#363636; border-width:thin; visibility:visible" >');
 window.document.writeln('<table  width="100%" height="80%" style="background-color:#363636"><tr>');
 if (aname=="create") {
  window.document.writeln('<td style="background-color:background-color:#363636"><U><B>NOUVEAU DOSSIER :</B></U></td><td style="background-color:#363636"></td></tr><tr>');
  window.document.writeln("<form action=\"index.php?dir="+pathn+"\" method=\"post\">");
  window.document.writeln('<td width="20%" style="background-color:#363636"><input type="text" name="Dname" style="background-color:whitesmoke; font-family: tahoma; border-style:solid; border-color:orangered; border-width:thin">'); 
  window.document.writeln('</td><td  style="background-color:#363636">');
  window.document.writeln('<input type="submit" name="Creer" value="OK" style="background-color:black; font-family: tahoma; color:gold;font-weight:bold; border-style:solid; border-color:whitesmoke; border-width:thin ">');
  window.document.writeln('<input type="submit" name="Annuler" value="ANNULER" style="background-color:black; font-family: tahoma; color:gold;font-weight:bold; border-style:solid; border-color:whitesmoke; border-width:thin">');
  window.document.writeln('</td></form></tr>');
 }
 window.document.writeln('</table></div>');   
}
  
mercredi 26 octobre 2005 à 19:52:58 | Re : Creer une boîte de dialogue

guill76

PS:Avant je le faisais en php mais je préfererais le faire coté client pour faciliter la navigation .
mercredi 26 octobre 2005 à 21:40:08 | Re : Creer une boîte de dialogue

guill76

Réponse acceptée !

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='<table  width="100%" height="100%" style="background-color:#0A0000"><tr>'+
          '<td style="background-color:background-color:#0A0000"><U><B>NOUVEAU DOSSIER :</B></U></td><td style="background-color:#0A0000"></td></tr><tr>'+
    '<form action="index.php?dir='+pathn+'" method="post">'+
    '<td width="20%" style="background-color:#0A0000"><input type="text" name="Dname" style="background-color:whitesmoke; font-family: tahoma; border-style:solid; border-color:orangered; border-width:thin">'+
    '</td><td  style="background-color:#0A0000">'+
    '<input type="submit" name="Creer" value="OK" style="background-color:black; font-family: tahoma; color:gold;font-weight:bold; border-style:solid; border-color:whitesmoke; border-width:thin ">'+
    '<input type="submit" name="Annuler" value="ANNULER" style="background-color:black; font-family: tahoma; color:gold;font-weight:bold; border-style:solid; border-color:whitesmoke; border-width:thin">'+
    '</td></form></tr>'+      
    '</table>';
 window.document.getElementById("workzone").innerHTML=html;
 }

mercredi 26 octobre 2005 à 22:30:59 | Re : Creer une boîte de dialogue

guill76

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 ='<table  width="100%" height="100%" style="background-color:#0A0000"><tr>'+
    '<td style="background-color:background-color:#0A0000"><U><B>NOUVEAU DOSSIER :</B></U></td><td style="background-color:#0A0000"></td></tr><tr>'+
    '<form action="index.php?dir='+pathn+'" method="post">'+
    '<td width="20%" style="background-color:#0A0000"><input type="text" name="Dname" style="background-color:whitesmoke; font-family: tahoma; border-style:solid; border-color:orangered; border-width:thin">'+
    '</td><td  style="background-color:#0A0000">'+
    '<input type="submit" name="Creer" value="OK" style="background-color:black; font-family: tahoma; color:gold;font-weight:bold; border-style:solid; border-color:whitesmoke; border-width:thin ">'+
    '<input type="submit" name="Annuler" value="ANNULER" style="background-color:black; font-family: tahoma; color:gold;font-weight:bold; border-style:solid; border-color:whitesmoke; border-width:thin">'+
    '</td></form></tr>'+      
    '</table>';
 }
 if ( aname=="find" ) {
 html ='<table  width="100%" height="100%" style="background-color:#0A0000"><tr>'+
    '<td style="background-color:background-color:#0A0000"><U><B>RECHERCHER :</B></U></td><td style="background-color:#0A0000"></td></tr><tr>'+
    '<form action="index.php?dir='+pathn+'" method="post">'+
    '<td width="20%" style="background-color:#0A0000"><input type="text" name="Dname" style="background-color:whitesmoke; font-family: tahoma; border-style:solid; border-color:orangered; border-width:thin">'+
    '</td><td  style="background-color:#0A0000">'+
    '<input type="submit" name="Creer" value="OK" style="background-color:black; font-family: tahoma; color:gold;font-weight:bold; border-style:solid; border-color:whitesmoke; border-width:thin ">'+
    '<input type="submit" name="Annuler" value="ANNULER" style="background-color:black; font-family: tahoma; color:gold;font-weight:bold; border-style:solid; border-color:whitesmoke; border-width:thin">'+
    '</td></form></tr>'+      
    '</table>';
 }
window.document.getElementById("workzone").innerHTML=html;
 }
 
</script>
</head>
<body onclick="dlgBox('create','')">
#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
<div id="workzone" style="width:30%; height:80px; overflow: none; position:absolute; top:350; left:600; border-style:solid; border-color:#363636; border-width:thin; visibility:hidden" > 
</div>
</body>
</html>


Cette discussion est classée dans : page, document, window, boîte, writeln


Répondre à ce message

Sujets en rapport avec ce message

imprimer contenu textarea [ par bultez ] [size=1][b][brown]Bonjour à tous[black]Pour imprimer le contenu d'un TextAreaje n'ai trouvé que cette solution :Essais d'impression<input type=button Accès refuser dans Window.open() [ par Atorina ] Bonjour,J'ai fais un petit script que voiciresult=window.open("","menu_droite");result.document.writeln("");result.document window.onload et document.write => effacement de la page [ par cydelic ] Bonjour, J'aimerai savoir pourquoi quand on fait un window.onload et ensuite un document.write la page en court est effacer ? Ex: window.onload=Init centrer un popup avec FF..... [ par jacknikolson ] Salut à tous et bonne année.J'utilise un cms (pwsphp) avec une galerie d'images. Il y a un JS pour afficher les images en popup. je voudrais que l'ima Retour variable palette graphique [ par neooh56 ] Bonjour J'ai recupéré un script de pallette graphique je clic sur un bouton ca ouvre la palette et quand je clic sur une couleur ca la ferme et renvoi impression d'un document [ par manale ] bonjour, une petite question sur l'impression d'une page web. est il possible de supprimer les informations en haut et bas de page (le numéro de la p Javascript et explorer Bar: accéder à l'url de la page principal [ par davwart ] Bonjour à tous: je rencontre un problème sous internet explorer, et ,n'étant pas familiariser à l'environnement windows... j'ai un peu de mal à lé ré Marche pas sous IE [ par taxidogkiller ] Bonjour, j'ai télécharger un script de galerie d'image et en voulant le bidouiller je suis tomber sur des fonction javascript qui ne marche que sous m Print et load [ par zrelli ] j'ai besoin d'imprimer une fentre juste à l'evenemt load, j'ai rencontrer des pbs.voila mon code !var printwindow=window.open("_blank","print","");pri Problème appel fonction avec window.opener [ par Rouxy0076 ] Salut à tous,J'ai ma page appelante avec un select que je veux remplir grace à un autre select qui se trouve dans une popup que j'appelle avec ma page


Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

Photothèque

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,421 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales