The universal remote is a great invention, and now it's on the Web. It's a real improvement on the original remote, and it's much easier to use. So why is it called "universal"? There are actually a couple of reasons.
- If the remote cannot find the window that launched it, it creates its own.
- To add a form, such as a search, just change the target. No more parsing together keywords and search dialog.
To create a universal remote, you should begin by making a function to launch it. Put this function in the page that you want to launch the remote from.
A Search Is Just A Search
Something that you see in many remotes is a search feature. Adding a search feature, or almost any type of form, can be done quickly with the universal remote. Though you can preform a search (in a remote) by parsing together parts of the search "dialog" with a keyword, the method you will learn is easier and more adaptable. It works like this: instead of targeting the search to the current window, which is the remote itself, target the search to the opener window. Sounds pretty obvious, doesn't it. Other than that, the remote version of the search form can be identical to the original version.
Begin by placing your form in the remote as you would in any other scenario. There is only one thing that needs to be changed: the form's target. Since the opener is named "opener", make the form's target "opener". For this example, Webreference's search form is used.
<FORM ACTION="/cgi-bin/AT-webrefsearch.cgi" TARGET = "opener" METHOD="POST">
<INPUT NAME="search" size="37"><BR>
<INPUT TYPE="submit" NAME="Search" VALUE="Search">
by <INPUT TYPE="radio" NAME="mode" VALUE="concept" CHECKED>
concept or <INPUT TYPE="radio" NAME="mode" VALUE="simple">
keywords <INPUT TYPE="hidden" NAME="sp" VALUE="sp">
Finally, to launch the remote, you can use a link anywhere in the page:
or put the onLoad event handler in the BODY tag to display it automatically.
<BODY onLoad = "makeRemote()">