[Javascript] besoin de conseil

besoin de conseil [Javascript] - Programmation

Marsh Posté le 12-08-2003 à 18:33:55    

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
Reply

Marsh Posté le 12-08-2003 à 18:33:55   

Reply

Marsh Posté le 12-08-2003 à 18:37:43    

[: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
Reply

Marsh Posté le 12-08-2003 à 19:25:29    

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. }

Reply

Marsh Posté le 14-08-2003 à 09:53:26    

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+'";)

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed