A couple of issues there:
1. Selectors
Just do the string substitution in your head. If you're passing #main into your function, then your selectors end up looking like this:
$("'#main>#one'")...
Note the ' characters in there. Now, if you remove the ' characters, you'll get:
$("#main>#one")...
...which means "the element with the id "one" that's a child of the element with the id "main". That now works, but it suggests you're using the same id ("one") for more than one element. You cannot do that in HTML.
Your id="one" and id="two" elements should probably have class="one" and class="two" instead, and if so your code should look like this:
function myFunction(a)
{
$(a+">.one").stop(true, true).animate({left:'30px'},1100);
$(a+">.two").stop(true, true).animate({left:'30px'},1100);
}
2. Functions
In your code calling myFunction:
$("#main").mouseleave(myFunction("#main")); // <== Wrong
...you're calling myFunction immediately and passing its return value into mouseleave. Since it has no explicit return value, you end up assing undefined into mouseleave, which won't do anything useful.
If your goal is to have myFunction called when the mouseleave event occurs, you pass in a function reference:
$("#main").mouseleave(function() {
myFunction("#main");
});
It may be worth stepping back from your current task and working through a few basic jQuery (and JavaScript) tutorials, to cement your understanding some of these concepts like ids being unique, passing functions as event handlers, string concatenation, etc.