If you use GreaseMonkey, any functions that you define are isolated by GM and are not available in the main window.
However, when you use any of the native functions, such as setTimeout or alert, they are called in the context of the main window, for example; when you call setTimeout you actually call window.setTimeout()
Now the function that you defined, the mark does not exist in the main window, and what you are asking for setTimeout is to evaluate the line "mark ()". When the timeout fires, window.eval( 'mark()' ) is called and, as discussed, window.mark is undefined. Thus, you have several options:
1) Define the label on the window object. GM allows you to do this using the unsafeWindow object as follows:
unsafeWindow.mark = function(){} setTimeout( 'mark()', 10 );
2) Pass the link to the local label in setTimeout:
function mark(){} setTimeout( mark, 10 );
But what if you need to send parameters? If you defined your function in the main window, the eval method will work (but it's ugly - don't do this)
unsafeWindow.mark2 = function( param ) { alert( param ) } setTimeout( 'mark2( "hello" )', 10 );
But this method will work for functions with parameters if you defined them in the main window or just in GM. The call ends with an anonymous function and passed to setTimeout
setTimeout( function() { mark2( "hello" ) }, 10 );