there are many ways to do it.
the most common is probably loading the script as text ajax style the using eval() to turning the text into javascript. I personally don't like using eval. what I prefer to do is to use the dom to add a script tag. You have to use dom methods innerhtml doesn't work for this. here is an example of the script to do this. javascript:(function(){var head=document.getElementsByTagName('head').item(0);var scriptTag=document.getElementById('loadScript');if(scriptTag)head.removeChild(scriptTag);script=document.createElement('script');script.src='http://localhost:6673/bm/bm.js';script.type='text/javascript';script.id='loadScript';head.appendChild(script)})(); another method i like especially if i want to load someone else's script is using innerhtml to load an iframe it has to be 1x1 pixel if you use display none it will fail in webkit browers (safari) here are some writes ups on the various methods. in the end it depends on what you want to do. http://ajaxpatterns.org/On-Demand_Javascript http://ajaxpatterns.org/Lazy_Inheritance -- Scott Wickham ******************************************************************************************** Everyone is equal and everyone is the best at everything. --- Principal Skinner "Success is a lousy teacher. It seduces smart people into thinking they can't lose." -Bill Gates 99% of the time, in my experience, the hard part about creativity isn't coming up with something no one has ever thought of before. The hard part is actually executing the thing you've thought of. -- seth godin ********************************************************************************************