Some people here may know that I've been trying to find a js reloader.
With IE you can change the src of script[0], but with NS you needed an empty script so you can call a new js source to it.....
just done some experimenting and came up with this.......give it a try, set up 2 external js files, js1.js and js2.js, with a different alert in each.Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>untitled</title> </head> <script type="text/javascript" language="javascript"> function changeScript(newScript) { oldScript=document.getElementsByTagName("script" )[1] var newEl = document.createElement('script'); newEl.setAttribute('type', 'text/javascript'); newEl.setAttribute('src', newScript); oldScript.parentNode.replaceChild(newEl,oldScript); changeScript.el = newEl; return true; } </script> <body> <script type="text/javascript" src="js1.js"></script> <button onclick="changeScript('js2.js')">New JS</button> <button onclick="changeScript('js1.js')">Old JS</button> </body> </html>
works in NS and IE ( don't know about firebird, but not in opera )
Is there something I can add to this script to stop it caching it's js, like a delete???




Bookmarks