Forum

Forum (https://www.coolstreaming.us/forum/)
-   Hardware & Software (https://www.coolstreaming.us/forum/a/)
-   -   [help] script popup (https://www.coolstreaming.us/forum/a/351402-a.html)

zibibbo 11-11-2008 11:15 AM

[help] script popup
 
per voi sarā una caxxata ma non trovo modo di far aprire un popup centrato delle dimensioni che voglio io cliccando su un link:(

ne ho trovato alcuni.

il primo fa quello che voglio io ma non č centrato :( top e left sono a 10

Code:
<script type="text/javascript"> <!-- var stile = "top=10, left=10, width=250, height=200, status=no, menubar=no, toolbar=no scrollbar=no"; function Popup(apri) { window.open(apri, "", stile); } //--> </script>



il secondo mi permette di centrarlo ma la funzione messa nella pagina richiama un solo link "mioFile.htm" :( mentre a me serve che per ogni link si apre un popup diverso :confused:

Code:
<script type="text/javascript"> <!-- function PopupCentrata() { var w = 400; var h = 250; var l = Math.floor((screen.width-w)/2); var t = Math.floor((screen.height-h)/2); window.open("mioFile.htm","","width=" + w + ",height=" + h + ",top=" + t + ",left=" + l); } //--> </script>


come faccio a incrociare i due? ho provato a mettere le variabili del secondo nel primo ma non mi ridā il popup con le dimensioni che metto io :confused:

Ogher 11-11-2008 11:33 AM

HTML Code:
<script type="text/javascript"> <!-- function PopupCentrata(pagina) { var w = 400; var h = 250; var l = Math.floor((screen.width-w)/2); var t = Math.floor((screen.height-h)/2); window.open(pagina,"","width=" + w + ",height=" + h + ",top=" + t + ",left=" + l); } //--> </script>

basta che passi la pagina come parametro alla funzione..

zibibbo 11-11-2008 02:55 PM

grazie lo stesso :) avevo giā risolto con questo
Code:
<script language="javascript"> var win = null; function NewWindow(mypage,myname,w,h){ LeftPosition = (screen.width) ? (screen.width-w)/2 : 0; TopPosition = (screen.height) ? (screen.height-h)/2 : 0; settings = 'height='+h+',width='+w+',top='+TopPosition+',left ='+LeftPosition+',scrollbars=no ,menubar=no ,resizable=no' win = window.open(mypage,myname,settings) } </script>


All times are GMT +2. The time now is 10:35 AM.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.