Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1350 connectés 

  FORUM HardWare.fr
  Programmation

  [Javascript] besoin de conseil

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[Javascript] besoin de conseil

n°485286
popgael
Posté le 12-08-2003 à 18:33:55  profilanswer
 

voila j'ai trouvé un javascript qui permet d'ouvrire un pop-up d'une url intégrée dans le javascript tout en pouvant parametrer la taille du pop-up:
 
<script language="JavaScript">
function openWindow(width,height) {
x = (640 - width)/2, y = (480 - height)/2;
if (screen) {
y = (screen.availHeight - height)/2;
x = (screen.availWidth - width)/2;
}
if (screen.availWidth > 1800) {  
x = ((screen.availWidth/2) - width)/2;  
}  
window.open('lien a ouvrire dans le pop up','newWin','width='+width+',height='+height+',screenX='+x+',screenY='+y+',top='+y+',left='+x);
}
 
 
 
mais je voudrais integrer en plus des parametre "height" et "width" le parametre "url" pour pouvoir utiliser le javascript avec plusieurs urls sans toucher a la base du javascript donc, j'ai fais ca mais ca ne marche pas qqun a une idée ?
 
 
<script language="JavaScript">
function openWindow(url,width,height) {
x = (640 - width)/2, y = (480 - height)/2;
if (screen) {
y = (screen.availHeight - height)/2;
x = (screen.availWidth - width)/2;
}
if (screen.availWidth > 1800) {  
x = ((screen.availWidth/2) - width)/2;  
}  
window.open('+url+','newWin','width='+width+',height='+height+',screenX='+x+',screenY='+y+',top='+y+',left='+x);
}


Message édité par popgael le 12-08-2003 à 18:35:18
mood
Publicité
Posté le 12-08-2003 à 18:33:55  profilanswer
 

n°485287
The Real P​hoenix
Posté le 12-08-2003 à 18:37:43  profilanswer
 

[:totozzz]  
 
ca c'est sur prog plutot...


Message édité par The Real Phoenix le 12-08-2003 à 18:38:05

---------------
Portfolio: http://www.suzaku.fr | Blog: http://blog.suzaku.fr
n°485349
kfman
Credo quia absurdum
Posté le 12-08-2003 à 19:25:29  profilanswer
 

Et comme ça ?
 

Code :
  1. <script language="JavaScript">
  2. function openWindow(url,width,height) {
  3. x = (640 - width)/2, y = (480 - height)/2;
  4. if (screen) {
  5. y = (screen.availHeight - height)/2;
  6. x = (screen.availWidth - width)/2;
  7. }
  8. if (screen.availWidth > 1800) { 
  9. x = ((screen.availWidth/2) - width)/2; 
  10. window.open(url,'newWin','width='+width+',height='+height+',screenX='+x+',screenY='+y+',top='+y+',left='+x);
  11. }

n°486838
rufo
Pas me confondre avec Lycos!
Posté le 14-08-2003 à 09:53:26  profilanswer
 

Citation :

window.open('+url+','newWin','width='+width+',height='+height+',screenX='+x+',screenY='+y+',top='+y+',left='+x);
}


 
C'est clair, y'a un pb avec le "'+url+'";)


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation

  [Javascript] besoin de conseil

 

Sujets relatifs
Besoin d'aide | Création autorun avec lien hypertextecode CSS foireux ou bug de ie? (si c'est le cas j'ai besoin d'un fix)
[Résolu] Impossible d'exécuter des javascriptconnaitre la largeur d'une chaine en javascript
[cfm]Besoin d'aide pour des scripts cfm.[Javascript easy] J'arrive pas a trouver pkoi ca marche pas....
Feuilles de style et besoin d'explication[JS] menu en JavaScript + Frame [résolu]
Acces restreint à une page en JavascriptBesoin d'aide sur les OLEObjects sous D7
Plus de sujets relatifs à : [Javascript] besoin de conseil


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR