cortic
10-28-2002, 02:32 AM
Ok, here's how this works, I need to load a clients info every time they log in, so I work with cookies - a name that represents a js file and a pass that gets cleared in any perl based changes to said js file, I set all the needed functions up and they work great with a static js (<script src="test.js></script>) but I need this to be dynamic, so:
var scriptTag = document.getElementById('loadScript');
var head = document.getElementsByTagName('head').item(0)
if(scriptTag) head.removeChild(scriptTag);
script = document.createElement('script');
script.src = "users/"+sell_it+".js";
script.type = 'text/javascript';
script.id = 'loadScript';
head.appendChild(script)
first off the removeChild and everything above applies to the admin - level of the script, it loads all client js files (with use of a drop down) and so needs to be replaced to stop different client files getting muddled, the sell_it variable is the name of the js file - held in the cookie or in this case the drop down.
--finally to the problem, I have an iframe on the page that holds and handles perl (for easy feedback) but once the above script is run I cant get access to the iframe, I think its because the js file doesn't finish loading -for some reason, so technically the page hasn't loaded and the frames[''] isn't available...?
Any comment on this would be greatly appreciated, I've been working on this for hours and I get the feeling its something simple I'm missing.
var scriptTag = document.getElementById('loadScript');
var head = document.getElementsByTagName('head').item(0)
if(scriptTag) head.removeChild(scriptTag);
script = document.createElement('script');
script.src = "users/"+sell_it+".js";
script.type = 'text/javascript';
script.id = 'loadScript';
head.appendChild(script)
first off the removeChild and everything above applies to the admin - level of the script, it loads all client js files (with use of a drop down) and so needs to be replaced to stop different client files getting muddled, the sell_it variable is the name of the js file - held in the cookie or in this case the drop down.
--finally to the problem, I have an iframe on the page that holds and handles perl (for easy feedback) but once the above script is run I cant get access to the iframe, I think its because the js file doesn't finish loading -for some reason, so technically the page hasn't loaded and the frames[''] isn't available...?
Any comment on this would be greatly appreciated, I've been working on this for hours and I get the feeling its something simple I'm missing.