Hi Mike, I have been playing with this and I am running into trouble.
Basically I output my new javascript into the body of my html, like so: <scr*pt l*nguage="j*vascript"> alert('fired 1'); $('#slideShowasset1').innerfade({ animationtype: 'fade', speed: 'slow', timeout: 1000, type: 'sequence', containerheight: 'auto'}); </sc*ipt> Firefox will behave properly, but safari and IE 6 don't do anything. What am I missing? Thanks a lot. Michael Geary wrote: > > >> From: juliandormon >> >> Is it possible to write javascript dynamically so new >> functions are created with the new parameters once the user >> makes a change? These functions need to be added to the head >> of my page because they get called after other functions. In >> other words, the new functions interact with the javascript >> that's already on the page. I guess they could be written >> elsewhere dynamically within a main function and I simply >> call this remote function and thereby any sub functions that >> have been written to it. Is this possible? > > JavaScript is a dynamic language. A *very* dynamic language. You can do > anything, any time. > > JavaScript functions do not reside in the head nor the body of the > document. > All global functions are actually properties of the window object. Where > or > when you define them has no effect on that. > > Consider this piece of code: > > myfunction = function() { alert( 'hi!' ); }; > > You could execute that code in a script tag in the head, in a script tag > in > the body, in a script that you load dynamically, or in a script that you > *create on the fly*. It will do the same thing regardless. > > How about this one: > > eval( "myfunction = function() { alert( 'hi!' ); };" ); > > That does exactly the same thing, but now you're using a string that you > could have generated any way you like. > > If there is other code in the page that calls myfunction(), and you later > redefine myfunction, that existing code will start using your new > function. > > One exception: Suppose a piece of code does this, or something like it: > > var savemyfunction = myfunction; > > And then that code calls savemyfunction(). Code like that will not pick up > your new function definition, because it has already saved a reference to > the previous "myfunction". > > I didn't look at your specific question about innerFade, I'm just > addressing > the general question of defining functions dynamically. > > -Mike > > > -- View this message in context: http://www.nabble.com/Dynamically-set-function-settings--tf4120797s15494.html#a11756212 Sent from the JQuery mailing list archive at Nabble.com.