html中父子窗口关系

父窗口

pare.htm

< HTML >
< HEAD >
< TITLE > showModelessDialogEX.htm </ TITLE >
< SCRIPT > ...
varsUserName="";
varss="woaini";
functionfnCallDialog()
...{
showModelessDialog(
"myDialog.htm",window,"status:false;dialogWidth:300px;dialogHeight:300px");
}

functionfnUpdate()
...{
oName.innerText
=sUserName;
}

</ SCRIPT >
</ HEAD >
< BODY >
< P > Enteryourfirstname: < SPAN ID ="oName" STYLE ="color:red;font-size:24" > Joan </ SPAN ></ P >
< INPUT TYPE ="button" VALUE ="显示子窗口" onclick ="fnCallDialog()" >
</ BODY >
</ HTML >

子窗口;myDialog.htm


< HTML >
< HEAD >
< TITLE > myDialog.htm </ TITLE >
< SCRIPT > ...
functionfnGetInfo()...{

varsData=dialogArguments;
alert(sData.ss);
sData.sUserName
=oEnterName.value;
sData.fnUpdate();
}

functionfnCancel()...{
varsData=dialogArguments;
sData.sUserName
="Joan";
sData.fnUpdate();
}

</ SCRIPT >
</ HEAD >
< BODY ><
<LABEL
FOR ="oEnterName" ACCESSKEY ="f" >
Enteryour
< SPAN STYLE ="text-decoration:underline" > F </ SPAN > irstName </ LABEL >
< INPUT ID =oEnterName >< BR >< BR >
< INPUT VALUE ="Apply" TYPE =button onclick ="fnGetInfo();" >
< INPUT VALUE ="Ok" TYPE =button onclick ="fnGetInfo();window.close();" >
< INPUT VALUE ="Cancel" TYPE =button onclick ="fnCancel();window.close();" >
</ BODY >
</ HTML >

你可能感兴趣的:(html)