Sujet : [Javascript] besoin de conseil |
rufo |
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+'";) |
popgael |
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);
} |