Hii nerssi!!
You can change he behaviour of javascript file(.ie code) by replacing the existing included javascript(.
js) file.
e.g
if temp.
js file is already there in web page,
you can change this temp.
js file
but i m not sure about the way you are doing is working or not.
its better you change your temp.
js file after loading the page or on any other event
hope this will help you.
Cheers :)
vinod