Ciao Guderian,
ho provato un popup in dhtml l'unico problema è che non riesco a capire come farlo richiamare dal form, mi spiego:
Ho questa funzione:
Codice PHP:
var dragapproved=false
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all
function iecompattest(){
return (document.compatMode!="BackCompat")? document.documentElement : document.body
}
function drag_drop(e){
if (ie5&&dragapproved&&event.button==1){
document.getElementById("dwindow").style.left=tempx+event.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
document.getElementById("dwindow").style.left=tempx+e.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+e.clientY-offsety+"px"
}
}
function initializedrag(e){
offsetx=ie5? event.clientX : e.clientX
offsety=ie5? event.clientY : e.clientY
document.getElementById("dwindowcontent").style.display="none" //extra
tempx=parseInt(document.getElementById("dwindow").style.left)
tempy=parseInt(document.getElementById("dwindow").style.top)
dragapproved=true
document.getElementById("dwindow").onmousemove=drag_drop
}
function loadwindow(url,width,height){
if (!ie5&&!ns6)
window.open(url,"","width=width,height=height,scrollbars=1")
else{
document.getElementById("dwindow").style.display=''
document.getElementById("dwindow").style.width=initialwidth=width+"px"
document.getElementById("dwindow").style.height=initialheight=height+"px"
document.getElementById("dwindow").style.left="150px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30+"px" : iecompattest().scrollTop*1+30+"px"
document.getElementById("cframe").src=url
}
}
function maximize(){
if (minrestore==0){
minrestore=1 //maximize window
document.getElementById("maxname").setAttribute("src","restore.gif")
document.getElementById("dwindow").style.width=ns6? window.innerWidth-20+"px" : iecompattest().clientWidth+"px"
document.getElementById("dwindow").style.height=ns6? window.innerHeight-20+"px" : iecompattest().clientHeight+"px"
}
else{
minrestore=0 //restore window
document.getElementById("maxname").setAttribute("src","max.gif")
document.getElementById("dwindow").style.width=initialwidth
document.getElementById("dwindow").style.height=initialheight
}
document.getElementById("dwindow").style.left=ns6? window.pageXOffset+"px" : iecompattest().scrollLeft+"px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset+"px" : iecompattest().scrollTop+"px"
}
function closeit(){
document.getElementById("dwindow").style.display="none"
}
function stopdrag(){
dragapproved=false;
document.getElementById("dwindow").onmousemove=null;
document.getElementById("dwindowcontent").style.display="" //extra
}
Iframe
Codice PHP:
<div id="dwindow" style="position:absolute;background-color:#EBEBEB;cursor:hand;left:0px;top:0px;display:none" onMousedown="initializedrag(event)" onMouseup="stopdrag()" >
<div align="right" style=" width: 100%;">[img]immagini/chiudi.jpg[/img]</div>
<div id="dwindowcontent" style="height:100%;">
<iframe id="cframe" width="100%" height="100%"></iframe>
</div>
</div>
e questo form
Codice PHP:
<form action="newsletter.asp" method="post" id="newsletter" name="newsletter">
<table cellpadding="0" width="220"cellspacing="0" border="0" style="border-bottom: 1px dotted #cccccc; margin-bottom: 10px;">
<tr>
<td width="20"style="padding-left: 5px;">Email:</td>
<td width="50" align="right">[img]immagini/input_left.gif[/img]</td>
<td width="100"><input name="email" class="input-all" type="text"></td>
<td width="50">[img]immagini/input_right.gif[/img]</td>
</tr>
</table>
<table>
<tr>
<td><input name="operazione" type="radio" value="cancellami"></td>
<td>Cancellami</td>
<td><input name="operazione" type="radio" value="iscrivimi"></td>
<td>Iscrivimi</td>
<td align="right" style="padding-top: 5px; padding-bottom: 5px;">[url="javascript:loadwindow('newsletter.asp',240,240)"]Invia[/url]</td>
</tr>
</table>
</form>
In questa situazione quando effettuo un inserimento (iscrizione - cancellazione - campi vuoti) apre la pagina newsletter.asp senza passare dal popup. Io ho bisogno di restituire tutti i risultati dei controlli all'interno di questo popup e non in un'altra pagina. Se inserisco nella action del form questa action="javascript:loadwindow('newsletter.asp',240 ,240)" il popup lo visualizzo ma non mi effettua tutti i controlli, quindi deduco che non passi il value degli input. Come posso fare??