You are here: irt.org | FAQ | JavaScript | Window | Q1180 [ previous next ]
Try:
<script language="JavaScript"><!-- var windowHandle = null; function openPopup(letter) { windowHandle = window.open('about:blank','windowName','width=300,height=300'); setTimeout('updatePopup("' + letter + '")',1); } function updatePopup(letter) { var output = ''; if (letter == 'A') { output = formatList('ant','antelope','apple','axe'); } if (letter == 'B') { output = formatList('ball','bee','belt','box'); } // ... if (letter == 'Z') { output = formatList('zebra','zoo','zulu'); } windowHandle.document.open(); windowHandle.document.write(output); windowHandle.document.close(); } function formatList() { var output = '<ul>'; for (var i=0; i<arguments.length; i++) { output+='<li><a href="javascript:close()" onClick="opener.document.myForm.search.value=\'' + arguments[i] + '\'">' + arguments[i] + '<\/a><\/li>'; } output += '<\/ul>'; return output; } //--></script> <a href="javascript:openPopup('A')">A</a> <a href="javascript:openPopup('B')">B</a> ... <a href="javascript:openPopup('Z')">Z</a> <form name="myForm"> <input type="text" name="search"> </form>