Popup Window Selection Updates Form Box

[Total: 0    Average: 0/5]

This example will use an href to open up a new window that has 2 hrefs on it.

Head Code:

<script>
var _v  = "<html><head><"+"script>";
    _v += "function passBack(_a){opener.catchIt(_a);self.close();}";
    _v += "<"+"/script></head><body>";
    _v += "<a href='#' onclick=passBack('ONE')>ONE</a><BR>";
    _v += "<a href='#' onclick=passBack('TWO')>TWO</a>";
    _v += "</body></html>";
var newWin=null;
function doIt()
{
  newWin=window.open("","","width=100,height=100,top=100,left=100");
  newWin.document.open();
  newWin.document.write(_v);
  newWin.document.close();
}
function catchIt(_z)
{
   if (document.all)
   {
   document.all.one.innerHTML=_z;
   document.all.two.innerHTML="Choose again?";
   }
   document.justforshow.data.value=_z; /* just for show */
}
</script>

Body Code:

<a id=one>DEFAULT TEXT</a>
<BR>
<a id=two href="#" onclick="doIt()">start this off</a>
<BR>
<form name=justforshow>
Just for Show: <input type=text name=data value="">
</form>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *