The code: Here are three JavaScript files for the taking
You are free to take the code and modify it or use it as is in any kind of project. This is code is intended for demonstration and you are responsible for its reliability and fitness for purpose in your projects.
You can check the following resources on this topic and see different permutations on how to do remote scripting with an iframe. This can help you adapt this script to your project needs.
Apple Developer Connection: Remote Scripting with IFrame.
Ashley IT: Remote Scripting Resources ...and home of JSRS.
O'Reilly WebDev Center: Remote Scripting with IFrame.
PHP Builder: Remote Scripting with Javascript, IFrames and PHP.
PXL8: Remote Scripting - Introduction.
Quirksmode: 2005: The year of data retrieval.