How do I dynamically load a js file using Prototype?

"href" : "none" //determine corresponding attribute to test for var allsuspects=document. GetElementsByTagName(targetelement) for (var i=allsuspects. Length; i>=0; i--){ //search backwards within nodelist for matching elements to remove if (allsuspectsi && allsuspectsi.

GetAttribute(targetattr)! =null && allsuspectsi. GetAttribute(targetattr).

IndexOf(filename)! =-1) allsuspectsi.parentNode. RemoveChild(allsuspectsi) //remove element by calling parentNode.removeChild() } } removejscssfile("somescript.

Js", "js") //remove all occurences of "somescript. Js" on page removejscssfile("somestyle. Css", "css") //remove all occurences "somestyle.

Css" on page If you don't need the CSS removing functionality, I'm sure you can hack it away.

– Theo. T Apr 5 '09 at 17:52 No, actually it's not. But yes, I thought that that was the problem.

If my new . Js file loads function which has the same name as in the first . Js file it will use the second one and that is what I wanted.

– domagoj412 Apr 7 '09 at 7:36.

I don't think you can unload a set of properties defined within the scope of a file. A workaround would be to define the functions contained in each file in a central object that you scrap (or override) whenever you want to get rid of it.

HI MAN DO THIS: function UpdateJS(file) { $('jscode'). InnerHTML = ''; /*YOU NEED TO RESET THIS*/ var url = 'main. Js'; /*YOU CAN USE A JAVASCRIPT FILE*/ var myAjax = new Ajax.

Request( url, {method: 'get', onComplete: showResponseHeader} ); } function showResponseHeader (originalRequest) { $('jscode'). InnerHTML = originalRequest. ResponseText; }.

I am using prototype to load external js file (actually it is php file) dynamically. And it works! But if some different file is called, all the functions from previous one are preserved.

And I don't want that. Anybody knows how to "unload" first js file when second one is called? (I also tried using Ajax.

It turns out that there is bigger problem: it only loads if function "UpdateJS" is in window. Onload that is why it doesn't load anything else after that. So prototypes update it's maybe not such a good way for this...

Hop featuring the voice of Russell Brand should be out on DVD on September 5, 2011. The film came out in theaters on April 1, 2011.

This movie does not yet have a synopsis. Check back soon! Spill.com puts a whole new spin on the "classic" movie review; turning dorky and dry into hilarious and hip.

Spill's reviews are high-quality animated videos featuring a regular cast of comic personalities. - Portions of Content Provided by Rovi Data Solutions © 2009 Rovi Data Solutions, Inc. Are you a Akira's Hip Hop Shop superfan?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions