besoin de conseil [Javascript] - Programmation
Marsh Posté le 12-08-2003 à 18:37:43
ca c'est sur prog plutot...
Marsh Posté le 12-08-2003 à 19:25:29
Et comme ça ?
Code :
|
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+'"
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