There are already a few scripts about that do what you want. One of which being "+Search" created by me, that allows you to add multiple search engines.
[Release] +Search (Version 1.2)
If you still want to go ahead and make your own, you can edit the source code and look for code regarding XMLHTTP (Google how to use XMLHTTP and it will explain it in detail)